{smcl}
{com}{sf}{ul off}{txt}{.-}
      name:  {res}<unnamed>
       {txt}log:  {res}/Users/kronick/Riker/Replication/log/logStata.smcl
  {txt}log type:  {res}smcl
 {txt}opened on:  {res}30 Nov 2022, 10:29:50
{txt}
{com}. clear all
{res}{txt}
{com}. 
. * deleting outputs so that everything is newly produced
. foreach x in "figures" "tables" {c -(}
{txt}  2{com}.         local files: dir "`x'" files *
{txt}  3{com}.         foreach file of local files {c -(}
{txt}  4{com}.                 rm "`x'/`file'"
{txt}  5{com}.         {c )-}
{txt}  6{com}. {c )-}
{txt}
{com}. 
. 
. *-------------------------------*
. * 3.) Create tables and figures *
. *-------------------------------*
. 
. do "code_Stata/0_PrepSurveyData.do"
{txt}
{com}.         
. 
.         ******************************************************************
.         **
.         **
.         **              DETAILS:        This file takes raw historical survey
.         **                                      data and creates a data set of 
.         **                                      vote intention by education group
.         **                                      by year, as well as proportions
.         **                                      of the population in each group.
.         **
.         **              NOTE:           I do not have permission to re-post
.         **                                      the full original surveys, so the
.         **                                      replication file includes only the
.         **                                      variables required for my analysis.
.         **                                      The full original files are all
.         **                                      publicly available: through
.         **                                      Roper center for 1973–1988, 
.         **                                      from Noam Lupu for 1993–2006,
.         **                                      and from LAPOP for 2012.
.         **
.         **
.         ******************************************************************
.                 
. 
. 
. 
. 
. 
. *-------------------------------------------------------------------------------
. * 1973 Survey
. *-------------------------------------------------------------------------------
. 
. 
. * loop over two education group options
. *--------------------------------------
.         /* baseline (main text), in which the top
>            education group is "secondary complete + tertiary complete,"
>            and tertiary (appendix), in which the 
>            top education group is tertiary only */
.            
. foreach edgroup in Baseline Tertiary {c -(}
{txt}  2{com}. 
. 
. * original data
. *--------------
. 
. use "data/inputs/Survey1973.dta", clear
{txt}  3{com}.                 
.                 
. * Indicators for voting AD in each year
. *--------------------------------------
.         
. gen voteAD_1958 = .
{txt}  4{com}. replace voteAD_1958 = 1 if vote1958 == 1
{txt}  5{com}. replace voteAD_1958 = 0 if vote1958 == 2 | vote1958 == 3
{txt}  6{com}. 
. gen voteAD_1963 = .
{txt}  7{com}. replace voteAD_1963 = 1 if vote1963 == 1
{txt}  8{com}. replace voteAD_1963 = 0 if vote1963 >= 2 & vote1963 <= 6
{txt}  9{com}. 
. gen voteAD_1968 = .
{txt} 10{com}. replace voteAD_1968 = 1 if vote1968 == 1
{txt} 11{com}. replace voteAD_1968 = 0 if vote1968 >= 2 & vote1968 <= 6
{txt} 12{com}. 
. gen voteAD_1973 = .
{txt} 13{com}. replace voteAD_1973 = 1 if vote1973 == 1
{txt} 14{com}. replace voteAD_1973 = 0 if vote1973 >= 2 & vote1973 <= 14
{txt} 15{com}. 
. 
. * Education groups
. *-----------------
. 
. gen educ = "No primary" if educ_original == 0 | educ_original == 1
{txt} 16{com}. replace educ = "Primary complete" if educ_original == 2 | educ_original == 3
{txt} 17{com}. replace educ = "Secondary complete" if educ_original >= 4 & educ_original <= 7
{txt} 18{com}. replace educ = "Tertiary complete" if educ_original == 8        
{txt} 19{com}. 
.         if "`edgroup'" == "Baseline" {c -(}
{txt} 20{com}.         /* This survey has <1% tertiary complete people */
.         replace educ = "Secondary + tertiary" if regexm(educ, "Secondary") | regexm(educ, "Tertiary")
{txt} 21{com}.         {c )-}
{txt} 22{com}.         
.         else {c -(}
{txt} 23{com}.         {c )-}
{txt} 24{com}.                 
. tab educ, gen(educ)     /* Group dummies; n.b. there are no missings */
{txt} 25{com}. 
. 
. * Loop over years in survey
. *--------------------------
.         
. forvalues year = 1958(5)1973 {c -(}
{txt} 26{com}.         
.         
.         * capture relationship between education and vote share
.         *------------------------------------------------------         
.         
.         if "`edgroup'" == "Baseline" {c -(} /* Top two groups together */
{txt} 27{com}.         reg voteAD_`year' educ1-educ3 if educ ~= "", nocons r
{txt} 28{com}.         lincomest 100*(_b[educ3] - _b[educ1])
{txt} 29{com}.                 tempfile dif`year'_`edgroup'
{txt} 30{com}.                 parmest, saving(`dif`year'_`edgroup'') idstr("dif`year'_`edgroup'") level(95)
{txt} 31{com}.                 {c )-}
{txt} 32{com}.         
.         else {c -(} 
{txt} 33{com}.         reg voteAD_`year' educ1-educ4 if educ ~= "", nocons r
{txt} 34{com}.         lincomest 100*(_b[educ4] - _b[educ1])
{txt} 35{com}.                 tempfile dif`year'_`edgroup'
{txt} 36{com}.                 parmest, saving(`dif`year'_`edgroup'') idstr("dif`year'_`edgroup'")     level(95)
{txt} 37{com}.                 {c )-}
{txt} 38{com}.         
. {c )-} /* Loop over years */
{txt} 39{com}. {c )-} /* Loop over edgroups */
{txt}(1,521 missing values generated)
(295 real changes made)
(283 real changes made)
(1,521 missing values generated)
(348 real changes made)
(393 real changes made)
(1,521 missing values generated)
(262 real changes made)
(692 real changes made)
(1,521 missing values generated)
(354 real changes made)
(671 real changes made)
(903 missing values generated)
variable {bf}{res}educ{sf}{txt} was {bf}{res}str10{sf}{txt} now {bf}{res}str16{sf}
{txt}(629 real changes made)
variable {bf}{res}educ{sf}{txt} was {bf}{res}str16{sf}{txt} now {bf}{res}str18{sf}
{txt}(260 real changes made)
(14 real changes made)
variable {bf}{res}educ{sf}{txt} was {bf}{res}str18{sf}{txt} now {bf}{res}str20{sf}
{txt}(274 real changes made)

                educ {c |}      Freq.     Percent        Cum.
{hline 21}{c +}{hline 35}
          No primary {c |}{res}        618       40.63       40.63
{txt}    Primary complete {c |}{res}        629       41.35       81.99
{txt}Secondary + tertiary {c |}{res}        274       18.01      100.00
{txt}{hline 21}{c +}{hline 35}
               Total {c |}{res}      1,521      100.00

{txt}Linear regression                               Number of obs     = {res}       578
                                                {txt}F(3, 575)         =  {res}   217.50
                                                {txt}Prob > F          = {res}    0.0000
                                                {txt}R-squared         = {res}    0.5346
                                                {txt}Root MSE          =    {res} .48867

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 14}{c |}{col 26}    Robust
{col 1} voteAD_1958{col 14}{c |} Coefficient{col 26}  std. err.{col 38}      t{col 46}   P>|t|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 7}educ1 {c |}{col 14}{res}{space 2} .5936599{col 26}{space 2}  .026435{col 37}{space 1}   22.46{col 46}{space 3}0.000{col 54}{space 4}  .541739{col 67}{space 3} .6455808
{txt}{space 7}educ2 {c |}{col 14}{res}{space 2}  .420765{col 26}{space 2} .0365891{col 37}{space 1}   11.50{col 46}{space 3}0.000{col 54}{space 4} .3489005{col 67}{space 3} .4926296
{txt}{space 7}educ3 {c |}{col 14}{res}{space 2}      .25{col 26}{space 2} .0626628{col 37}{space 1}    3.99{col 46}{space 3}0.000{col 54}{space 4}  .126924{col 67}{space 3}  .373076
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}{txt}Confidence interval for formula:
{res}100*(_b[educ3]-_b[educ1])

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1} voteAD_1958{col 14}{c |} Coefficient{col 26}  Std. err.{col 38}      t{col 46}   P>|t|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 9}(1) {c |}{col 14}{res}{space 2}-34.36599{col 26}{space 2} 6.801058{col 37}{space 1}   -5.05{col 46}{space 3}0.000{col 54}{space 4}-47.72394{col 67}{space 3}-21.00805
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{p 0 4 2}
file {bf}
/var/folders/b_/14sh0g7d0294l0trnz839fn1d84l60/T//S_55310.000001{rm}
saved
as .dta format
{p_end}

Linear regression                               Number of obs     = {res}       741
                                                {txt}F(3, 738)         =  {res}   234.29
                                                {txt}Prob > F          = {res}    0.0000
                                                {txt}R-squared         = {res}    0.4926
                                                {txt}Root MSE          =    {res} .48916

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 14}{c |}{col 26}    Robust
{col 1} voteAD_1963{col 14}{c |} Coefficient{col 26}  std. err.{col 38}      t{col 46}   P>|t|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 7}educ1 {c |}{col 14}{res}{space 2} .5555556{col 26}{space 2} .0244711{col 37}{space 1}   22.70{col 46}{space 3}0.000{col 54}{space 4} .5075143{col 67}{space 3} .6035968
{txt}{space 7}educ2 {c |}{col 14}{res}{space 2} .3899614{col 26}{space 2} .0303683{col 37}{space 1}   12.84{col 46}{space 3}0.000{col 54}{space 4} .3303428{col 67}{space 3} .4495799
{txt}{space 7}educ3 {c |}{col 14}{res}{space 2}      .25{col 26}{space 2} .0526171{col 37}{space 1}    4.75{col 46}{space 3}0.000{col 54}{space 4} .1467029{col 67}{space 3} .3532971
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}{txt}Confidence interval for formula:
{res}100*(_b[educ3]-_b[educ1])

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1} voteAD_1963{col 14}{c |} Coefficient{col 26}  Std. err.{col 38}      t{col 46}   P>|t|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 9}(1) {c |}{col 14}{res}{space 2}-30.55556{col 26}{space 2} 5.802927{col 37}{space 1}   -5.27{col 46}{space 3}0.000{col 54}{space 4}-41.94777{col 67}{space 3}-19.16334
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{p 0 4 2}
file {bf}
/var/folders/b_/14sh0g7d0294l0trnz839fn1d84l60/T//S_55310.000002{rm}
saved
as .dta format
{p_end}

Linear regression                               Number of obs     = {res}       954
                                                {txt}F(3, 951)         =  {res}   122.95
                                                {txt}Prob > F          = {res}    0.0000
                                                {txt}R-squared         = {res}    0.2878
                                                {txt}Root MSE          =    {res} .44295

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 14}{c |}{col 26}    Robust
{col 1} voteAD_1968{col 14}{c |} Coefficient{col 26}  std. err.{col 38}      t{col 46}   P>|t|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 7}educ1 {c |}{col 14}{res}{space 2} .3318872{col 26}{space 2} .0219661{col 37}{space 1}   15.11{col 46}{space 3}0.000{col 54}{space 4} .2887795{col 67}{space 3} .3749949
{txt}{space 7}educ2 {c |}{col 14}{res}{space 2} .2398922{col 26}{space 2} .0222046{col 37}{space 1}   10.80{col 46}{space 3}0.000{col 54}{space 4} .1963165{col 67}{space 3} .2834678
{txt}{space 7}educ3 {c |}{col 14}{res}{space 2} .1639344{col 26}{space 2} .0335706{col 37}{space 1}    4.88{col 46}{space 3}0.000{col 54}{space 4} .0980534{col 67}{space 3} .2298155
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}{txt}Confidence interval for formula:
{res}100*(_b[educ3]-_b[educ1])

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1} voteAD_1968{col 14}{c |} Coefficient{col 26}  Std. err.{col 38}      t{col 46}   P>|t|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 9}(1) {c |}{col 14}{res}{space 2}-16.79528{col 26}{space 2} 4.011854{col 37}{space 1}   -4.19{col 46}{space 3}0.000{col 54}{space 4}-24.66839{col 67}{space 3}-8.922169
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{p 0 4 2}
file {bf}
/var/folders/b_/14sh0g7d0294l0trnz839fn1d84l60/T//S_55310.000003{rm}
saved
as .dta format
{p_end}

Linear regression                               Number of obs     = {res}     1,025
                                                {txt}F(3, 1022)        =  {res}   188.29
                                                {txt}Prob > F          = {res}    0.0000
                                                {txt}R-squared         = {res}    0.3655
                                                {txt}Root MSE          =    {res}  .4688

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 14}{c |}{col 26}    Robust
{col 1} voteAD_1973{col 14}{c |} Coefficient{col 26}  std. err.{col 38}      t{col 46}   P>|t|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 7}educ1 {c |}{col 14}{res}{space 2} .4402985{col 26}{space 2} .0247956{col 37}{space 1}   17.76{col 46}{space 3}0.000{col 54}{space 4} .3916423{col 67}{space 3} .4889547
{txt}{space 7}educ2 {c |}{col 14}{res}{space 2} .3126437{col 26}{space 2} .0222591{col 37}{space 1}   14.05{col 46}{space 3}0.000{col 54}{space 4} .2689649{col 67}{space 3} .3563224
{txt}{space 7}educ3 {c |}{col 14}{res}{space 2} .2180851{col 26}{space 2} .0301613{col 37}{space 1}    7.23{col 46}{space 3}0.000{col 54}{space 4} .1588999{col 67}{space 3} .2772703
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}{txt}Confidence interval for formula:
{res}100*(_b[educ3]-_b[educ1])

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1} voteAD_1973{col 14}{c |} Coefficient{col 26}  Std. err.{col 38}      t{col 46}   P>|t|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 9}(1) {c |}{col 14}{res}{space 2}-22.22134{col 26}{space 2} 3.904521{col 37}{space 1}   -5.69{col 46}{space 3}0.000{col 54}{space 4}-29.88314{col 67}{space 3}-14.55954
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{p 0 4 2}
file {bf}
/var/folders/b_/14sh0g7d0294l0trnz839fn1d84l60/T//S_55310.000004{rm}
saved
as .dta format
{p_end}
(1,521 missing values generated)
(295 real changes made)
(283 real changes made)
(1,521 missing values generated)
(348 real changes made)
(393 real changes made)
(1,521 missing values generated)
(262 real changes made)
(692 real changes made)
(1,521 missing values generated)
(354 real changes made)
(671 real changes made)
(903 missing values generated)
variable {bf}{res}educ{sf}{txt} was {bf}{res}str10{sf}{txt} now {bf}{res}str16{sf}
{txt}(629 real changes made)
variable {bf}{res}educ{sf}{txt} was {bf}{res}str16{sf}{txt} now {bf}{res}str18{sf}
{txt}(260 real changes made)
(14 real changes made)

              educ {c |}      Freq.     Percent        Cum.
{hline 19}{c +}{hline 35}
        No primary {c |}{res}        618       40.63       40.63
{txt}  Primary complete {c |}{res}        629       41.35       81.99
{txt}Secondary complete {c |}{res}        260       17.09       99.08
{txt} Tertiary complete {c |}{res}         14        0.92      100.00
{txt}{hline 19}{c +}{hline 35}
             Total {c |}{res}      1,521      100.00

{txt}Linear regression                               Number of obs     = {res}       578
                                                {txt}F(4, 574)         =  {res}   162.89
                                                {txt}Prob > F          = {res}    0.0000
                                                {txt}R-squared         = {res}    0.5349
                                                {txt}Root MSE          =    {res} .48892

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 14}{c |}{col 26}    Robust
{col 1} voteAD_1958{col 14}{c |} Coefficient{col 26}  std. err.{col 38}      t{col 46}   P>|t|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 7}educ1 {c |}{col 14}{res}{space 2} .5936599{col 26}{space 2}  .026458{col 37}{space 1}   22.44{col 46}{space 3}0.000{col 54}{space 4} .5416937{col 67}{space 3} .6456262
{txt}{space 7}educ2 {c |}{col 14}{res}{space 2}  .420765{col 26}{space 2}  .036621{col 37}{space 1}   11.49{col 46}{space 3}0.000{col 54}{space 4} .3488376{col 67}{space 3} .4926924
{txt}{space 7}educ3 {c |}{col 14}{res}{space 2} .2682927{col 26}{space 2} .0694367{col 37}{space 1}    3.86{col 46}{space 3}0.000{col 54}{space 4} .1319117{col 67}{space 3} .4046737
{txt}{space 7}educ4 {c |}{col 14}{res}{space 2} .1428571{col 26}{space 2} .1327201{col 37}{space 1}    1.08{col 46}{space 3}0.282{col 54}{space 4} -.117819{col 67}{space 3} .4035333
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}{txt}Confidence interval for formula:
{res}100*(_b[educ4]-_b[educ1])

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1} voteAD_1958{col 14}{c |} Coefficient{col 26}  Std. err.{col 38}      t{col 46}   P>|t|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 9}(1) {c |}{col 14}{res}{space 2}-45.08028{col 26}{space 2} 13.53316{col 37}{space 1}   -3.33{col 46}{space 3}0.001{col 54}{space 4}-71.66083{col 67}{space 3}-18.49973
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{p 0 4 2}
file {bf}
/var/folders/b_/14sh0g7d0294l0trnz839fn1d84l60/T//S_55310.000005{rm}
saved
as .dta format
{p_end}

Linear regression                               Number of obs     = {res}       741
                                                {txt}F(4, 737)         =  {res}   175.51
                                                {txt}Prob > F          = {res}    0.0000
                                                {txt}R-squared         = {res}    0.4927
                                                {txt}Root MSE          =    {res} .48943

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 14}{c |}{col 26}    Robust
{col 1} voteAD_1963{col 14}{c |} Coefficient{col 26}  std. err.{col 38}      t{col 46}   P>|t|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 7}educ1 {c |}{col 14}{res}{space 2} .5555556{col 26}{space 2} .0244877{col 37}{space 1}   22.69{col 46}{space 3}0.000{col 54}{space 4} .5074816{col 67}{space 3} .6036295
{txt}{space 7}educ2 {c |}{col 14}{res}{space 2} .3899614{col 26}{space 2} .0303889{col 37}{space 1}   12.83{col 46}{space 3}0.000{col 54}{space 4} .3303023{col 67}{space 3} .4496205
{txt}{space 7}educ3 {c |}{col 14}{res}{space 2} .2419355{col 26}{space 2} .0545359{col 37}{space 1}    4.44{col 46}{space 3}0.000{col 54}{space 4} .1348713{col 67}{space 3} .3489997
{txt}{space 7}educ4 {c |}{col 14}{res}{space 2} .3333333{col 26}{space 2} .1929716{col 37}{space 1}    1.73{col 46}{space 3}0.085{col 54}{space 4}-.0455063{col 67}{space 3} .7121729
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}{txt}Confidence interval for formula:
{res}100*(_b[educ4]-_b[educ1])

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1} voteAD_1963{col 14}{c |} Coefficient{col 26}  Std. err.{col 38}      t{col 46}   P>|t|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 9}(1) {c |}{col 14}{res}{space 2}-22.22222{col 26}{space 2} 19.45191{col 37}{space 1}   -1.14{col 46}{space 3}0.254{col 54}{space 4}-60.40999{col 67}{space 3} 15.96554
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{p 0 4 2}
file {bf}
/var/folders/b_/14sh0g7d0294l0trnz839fn1d84l60/T//S_55310.000006{rm}
saved
as .dta format
{p_end}

Linear regression                               Number of obs     = {res}       954
                                                {txt}F(4, 950)         =  {res}    92.12
                                                {txt}Prob > F          = {res}    0.0000
                                                {txt}R-squared         = {res}    0.2878
                                                {txt}Root MSE          =    {res} .44318

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 14}{c |}{col 26}    Robust
{col 1} voteAD_1968{col 14}{c |} Coefficient{col 26}  std. err.{col 38}      t{col 46}   P>|t|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 7}educ1 {c |}{col 14}{res}{space 2} .3318872{col 26}{space 2} .0219777{col 37}{space 1}   15.10{col 46}{space 3}0.000{col 54}{space 4} .2887568{col 67}{space 3} .3750176
{txt}{space 7}educ2 {c |}{col 14}{res}{space 2} .2398922{col 26}{space 2} .0222163{col 37}{space 1}   10.80{col 46}{space 3}0.000{col 54}{space 4} .1962936{col 67}{space 3} .2834908
{txt}{space 7}educ3 {c |}{col 14}{res}{space 2} .1621622{col 26}{space 2} .0350595{col 37}{space 1}    4.63{col 46}{space 3}0.000{col 54}{space 4} .0933592{col 67}{space 3} .2309652
{txt}{space 7}educ4 {c |}{col 14}{res}{space 2} .1818182{col 26}{space 2} .1165359{col 37}{space 1}    1.56{col 46}{space 3}0.119{col 54}{space 4}-.0468793{col 67}{space 3} .4105157
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}{txt}Confidence interval for formula:
{res}100*(_b[educ4]-_b[educ1])

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1} voteAD_1968{col 14}{c |} Coefficient{col 26}  Std. err.{col 38}      t{col 46}   P>|t|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 9}(1) {c |}{col 14}{res}{space 2} -15.0069{col 26}{space 2} 11.85902{col 37}{space 1}   -1.27{col 46}{space 3}0.206{col 54}{space 4} -38.2798{col 67}{space 3} 8.265994
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{p 0 4 2}
file {bf}
/var/folders/b_/14sh0g7d0294l0trnz839fn1d84l60/T//S_55310.000007{rm}
saved
as .dta format
{p_end}

Linear regression                               Number of obs     = {res}     1,025
                                                {txt}F(4, 1021)        =  {res}   141.15
                                                {txt}Prob > F          = {res}    0.0000
                                                {txt}R-squared         = {res}    0.3659
                                                {txt}Root MSE          =    {res} .46887

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 14}{c |}{col 26}    Robust
{col 1} voteAD_1973{col 14}{c |} Coefficient{col 26}  std. err.{col 38}      t{col 46}   P>|t|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 7}educ1 {c |}{col 14}{res}{space 2} .4402985{col 26}{space 2} .0248078{col 37}{space 1}   17.75{col 46}{space 3}0.000{col 54}{space 4} .3916184{col 67}{space 3} .4889786
{txt}{space 7}educ2 {c |}{col 14}{res}{space 2} .3126437{col 26}{space 2}   .02227{col 37}{space 1}   14.04{col 46}{space 3}0.000{col 54}{space 4} .2689435{col 67}{space 3} .3563439
{txt}{space 7}educ3 {c |}{col 14}{res}{space 2} .2247191{col 26}{space 2} .0313465{col 37}{space 1}    7.17{col 46}{space 3}0.000{col 54}{space 4} .1632082{col 67}{space 3}   .28623
{txt}{space 7}educ4 {c |}{col 14}{res}{space 2}       .1{col 26}{space 2}  .095054{col 37}{space 1}    1.05{col 46}{space 3}0.293{col 54}{space 4}-.0865235{col 67}{space 3} .2865235
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}{txt}Confidence interval for formula:
{res}100*(_b[educ4]-_b[educ1])

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1} voteAD_1973{col 14}{c |} Coefficient{col 26}  Std. err.{col 38}      t{col 46}   P>|t|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 9}(1) {c |}{col 14}{res}{space 2}-34.02985{col 26}{space 2}  9.82379{col 37}{space 1}   -3.46{col 46}{space 3}0.001{col 54}{space 4}-53.30698{col 67}{space 3}-14.75272
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{p 0 4 2}
file {bf}
/var/folders/b_/14sh0g7d0294l0trnz839fn1d84l60/T//S_55310.000008{rm}
saved
as .dta format
{p_end}

{com}.         
. 
. 
. *-------------------------------------------------------------------------------
. * 1983 survey
. *-------------------------------------------------------------------------------
. 
. 
. * original data
. *--------------
. 
. use "data/inputs/Survey1983.dta", clear
{txt}
{com}. 
. 
. * Education groups
. *-----------------
. 
. gen educ = "No primary" if educ_original == 1    | educ_original == 2
{txt}(1,437 missing values generated)

{com}. replace educ = "Primary complete" if educ_original == 3 | educ_original == 4
{txt}variable {bf}{res}educ{sf}{txt} was {bf}{res}str10{sf}{txt} now {bf}{res}str16{sf}
{txt}(877 real changes made)

{com}. replace educ = "Secondary complete" if educ_original == 5 | educ_original == 6
{txt}variable {bf}{res}educ{sf}{txt} was {bf}{res}str16{sf}{txt} now {bf}{res}str18{sf}
{txt}(438 real changes made)

{com}. replace educ = "Tertiary complete" if educ_original == 7
{txt}(114 real changes made)

{com}. drop if educ == "" /* Dropping missings */
{txt}(8 observations deleted)

{com}. tab educ, gen(educ)      

              {txt}educ {c |}      Freq.     Percent        Cum.
{hline 19}{c +}{hline 35}
        No primary {c |}{res}        352       19.76       19.76
{txt}  Primary complete {c |}{res}        877       49.24       69.01
{txt}Secondary complete {c |}{res}        438       24.59       93.60
{txt} Tertiary complete {c |}{res}        114        6.40      100.00
{txt}{hline 19}{c +}{hline 35}
             Total {c |}{res}      1,781      100.00
{txt}
{com}. 
. 
. * Vote AD
. *--------
.         
. gen voteAD_1978 = .
{txt}(1,781 missing values generated)

{com}. replace voteAD_1978 = 1 if vote1978 == 1
{txt}(500 real changes made)

{com}. replace voteAD_1978 = 0 if vote1978 >= 2 & vote1978 <= 6
{txt}(601 real changes made)

{com}.                 
. gen voteAD_1983 = .
{txt}(1,781 missing values generated)

{com}. replace voteAD_1983 = 1 if vote1983 == 1
{txt}(743 real changes made)

{com}. replace voteAD_1983 = 0 if vote1983 >= 2 & vote1983 <= 7
{txt}(817 real changes made)

{com}.                                         
.                                                         
. * Loop over years
. *----------------
.         
. forvalues year = 1978(5)1983 {c -(}
{txt}  2{com}. 
.                 
.         * capture relationship between education and vote share
.         *------------------------------------------------------         
.                 
.         reg voteAD_`year' educ1-educ4 if educ ~= "", nocons r   
{txt}  3{com}.         lincomest 100*(_b[educ4] - _b[educ1])   
{txt}  4{com}.                 tempfile dif`year'
{txt}  5{com}.                 parmest, saving(`dif`year'') idstr("dif`year'") level(95)
{txt}  6{com}.         
. {c )-}

{txt}Linear regression                               Number of obs     = {res}     1,101
                                                {txt}F(4, 1097)        =  {res}   230.27
                                                {txt}Prob > F          = {res}    0.0000
                                                {txt}R-squared         = {res}    0.4570
                                                {txt}Root MSE          =    {res} .49748

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 14}{c |}{col 26}    Robust
{col 1} voteAD_1978{col 14}{c |} Coefficient{col 26}  std. err.{col 38}      t{col 46}   P>|t|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 7}educ1 {c |}{col 14}{res}{space 2} .4615385{col 26}{space 2} .0309731{col 37}{space 1}   14.90{col 46}{space 3}0.000{col 54}{space 4} .4007652{col 67}{space 3} .5223117
{txt}{space 7}educ2 {c |}{col 14}{res}{space 2} .4830189{col 26}{space 2} .0217456{col 37}{space 1}   22.21{col 46}{space 3}0.000{col 54}{space 4} .4403512{col 67}{space 3} .5256866
{txt}{space 7}educ3 {c |}{col 14}{res}{space 2} .4054054{col 26}{space 2} .0330118{col 37}{space 1}   12.28{col 46}{space 3}0.000{col 54}{space 4}  .340632{col 67}{space 3} .4701788
{txt}{space 7}educ4 {c |}{col 14}{res}{space 2} .3820225{col 26}{space 2} .0515972{col 37}{space 1}    7.40{col 46}{space 3}0.000{col 54}{space 4} .2807821{col 67}{space 3} .4832628
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}{txt}Confidence interval for formula:
{res}100*(_b[educ4]-_b[educ1])

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1} voteAD_1978{col 14}{c |} Coefficient{col 26}  Std. err.{col 38}      t{col 46}   P>|t|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 9}(1) {c |}{col 14}{res}{space 2}-7.951599{col 26}{space 2} 6.017977{col 37}{space 1}   -1.32{col 46}{space 3}0.187{col 54}{space 4}-19.75965{col 67}{space 3} 3.856448
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{p 0 4 2}
file {bf}
/var/folders/b_/14sh0g7d0294l0trnz839fn1d84l60/T//S_55310.000009{rm}
saved
as .dta format
{p_end}

Linear regression                               Number of obs     = {res}     1,560
                                                {txt}F(4, 1556)        =  {res}   359.84
                                                {txt}Prob > F          = {res}    0.0000
                                                {txt}R-squared         = {res}    0.4813
                                                {txt}Root MSE          =    {res} .49767

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 14}{c |}{col 26}    Robust
{col 1} voteAD_1983{col 14}{c |} Coefficient{col 26}  std. err.{col 38}      t{col 46}   P>|t|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 7}educ1 {c |}{col 14}{res}{space 2} .5187713{col 26}{space 2} .0292272{col 37}{space 1}   17.75{col 46}{space 3}0.000{col 54}{space 4} .4614425{col 67}{space 3} .5761002
{txt}{space 7}educ2 {c |}{col 14}{res}{space 2} .5051414{col 26}{space 2} .0179479{col 37}{space 1}   28.14{col 46}{space 3}0.000{col 54}{space 4} .4699367{col 67}{space 3} .5403461
{txt}{space 7}educ3 {c |}{col 14}{res}{space 2} .4107143{col 26}{space 2} .0248798{col 37}{space 1}   16.51{col 46}{space 3}0.000{col 54}{space 4} .3619128{col 67}{space 3} .4595158
{txt}{space 7}educ4 {c |}{col 14}{res}{space 2} .3814433{col 26}{space 2} .0493829{col 37}{space 1}    7.72{col 46}{space 3}0.000{col 54}{space 4} .2845793{col 67}{space 3} .4783073
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}{txt}Confidence interval for formula:
{res}100*(_b[educ4]-_b[educ1])

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1} voteAD_1983{col 14}{c |} Coefficient{col 26}  Std. err.{col 38}      t{col 46}   P>|t|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 9}(1) {c |}{col 14}{res}{space 2} -13.7328{col 26}{space 2} 5.738378{col 37}{space 1}   -2.39{col 46}{space 3}0.017{col 54}{space 4}-24.98857{col 67}{space 3}-2.477033
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{p 0 4 2}
file {bf}
/var/folders/b_/14sh0g7d0294l0trnz839fn1d84l60/T//S_55310.00000a{rm}
saved
as .dta format
{p_end}

{com}. 
. 
. *-------------------------------------------------------------------------------
. * 1988
. *-------------------------------------------------------------------------------
. 
.         
. * original data
. *--------------
.         
. use "data/inputs/Survey1988.dta", clear
{txt}
{com}. 
.                 
. * Vote AD
. *--------       
. 
. gen voteAD_1988 = .
{txt}(2,000 missing values generated)

{com}. replace voteAD_1988 = 1 if vote1988 == 1
{txt}(920 real changes made)

{com}. replace voteAD_1988 = 0 if vote1988 ~= 1 & vote1988 ~= . 
{txt}(710 real changes made)

{com}.                  
. 
. * Education groups
. *-----------------
. 
. gen educ = "No primary" if educ_original == 1    | educ_original == 2
{txt}(1,552 missing values generated)

{com}. replace educ = "Primary complete" if educ_original == 3 | educ_original == 4
{txt}variable {bf}{res}educ{sf}{txt} was {bf}{res}str10{sf}{txt} now {bf}{res}str16{sf}
{txt}(950 real changes made)

{com}. replace educ = "Secondary complete" if educ_original == 5 | educ_original == 6
{txt}variable {bf}{res}educ{sf}{txt} was {bf}{res}str16{sf}{txt} now {bf}{res}str18{sf}
{txt}(496 real changes made)

{com}. replace educ = "Tertiary complete" if educ_original == 7
{txt}(106 real changes made)

{com}. tab educ, gen(educ)     /* N.b. no missings */

              {txt}educ {c |}      Freq.     Percent        Cum.
{hline 19}{c +}{hline 35}
        No primary {c |}{res}        448       22.40       22.40
{txt}  Primary complete {c |}{res}        950       47.50       69.90
{txt}Secondary complete {c |}{res}        496       24.80       94.70
{txt} Tertiary complete {c |}{res}        106        5.30      100.00
{txt}{hline 19}{c +}{hline 35}
             Total {c |}{res}      2,000      100.00
{txt}
{com}.         
.         
. * years
. *------
.         
. local year = 1988       
{txt}
{com}. 
. 
.         * capture relationship between education and vote share
.         *------------------------------------------------------         
.                 
.         reg voteAD educ1-educ4, nocons r

{txt}Linear regression                               Number of obs     = {res}     1,630
                                                {txt}F(4, 1626)        =  {res}   534.81
                                                {txt}Prob > F          = {res}    0.0000
                                                {txt}R-squared         = {res}    0.5671
                                                {txt}Root MSE          =    {res}  .4949

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 14}{c |}{col 26}    Robust
{col 1} voteAD_1988{col 14}{c |} Coefficient{col 26}  std. err.{col 38}      t{col 46}   P>|t|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 7}educ1 {c |}{col 14}{res}{space 2}  .630814{col 26}{space 2} .0260512{col 37}{space 1}   24.21{col 46}{space 3}0.000{col 54}{space 4} .5797165{col 67}{space 3} .6819114
{txt}{space 7}educ2 {c |}{col 14}{res}{space 2} .5383648{col 26}{space 2} .0177026{col 37}{space 1}   30.41{col 46}{space 3}0.000{col 54}{space 4} .5036424{col 67}{space 3} .5730871
{txt}{space 7}educ3 {c |}{col 14}{res}{space 2} .5731707{col 26}{space 2} .0244574{col 37}{space 1}   23.44{col 46}{space 3}0.000{col 54}{space 4} .5251994{col 67}{space 3} .6211421
{txt}{space 7}educ4 {c |}{col 14}{res}{space 2} .4938272{col 26}{space 2} .0556196{col 37}{space 1}    8.88{col 46}{space 3}0.000{col 54}{space 4} .3847335{col 67}{space 3} .6029208
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}{txt}
{com}.         lincomest 100*(_b[educ4] - _b[educ1])   
{txt}Confidence interval for formula:
{res}100*(_b[educ4]-_b[educ1])

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1} voteAD_1988{col 14}{c |} Coefficient{col 26}  Std. err.{col 38}      t{col 46}   P>|t|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 9}(1) {c |}{col 14}{res}{space 2}-13.69868{col 26}{space 2} 6.141828{col 37}{space 1}   -2.23{col 46}{space 3}0.026{col 54}{space 4}-25.74541{col 67}{space 3} -1.65195
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}

{com}.                 tempfile dif`year'
{txt}
{com}.                 parmest, saving(`dif`year'') idstr("dif`year'") level(95)
{txt}{p 0 4 2}
file {bf}
/var/folders/b_/14sh0g7d0294l0trnz839fn1d84l60/T//S_55310.00000b{rm}
saved
as .dta format
{p_end}

{com}.         
. 
. 
. *-------------------------------------------------------------------------------
. * 1993–2006
. *-------------------------------------------------------------------------------
.         
.         
. * Lupu replication data
. *----------------------
.         
. use "data/inputs/Survey1993_2006_Lupu.dta", clear
{txt}
{com}. 
. 
. * Vote AD
. *--------               
. 
. gen voteAD_1993 = .
{txt}(7,206 missing values generated)

{com}. replace voteAD_1993 = 1 if vote1993 == 4
{txt}(133 real changes made)

{com}. replace voteAD_1993 = 0 if vote1993 >= 1 & vote1993 <= 3
{txt}(500 real changes made)

{com}. 
. 
. * Education groups
. *-----------------
. 
. tab educ, gen(educ) /* Missings excluded below */

   {txt}Original {c |}
educ coding {c |}
    in Lupu {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
          0 {c |}{res}        924       13.43       13.43
{txt}          1 {c |}{res}      3,033       44.10       57.53
{txt}          2 {c |}{res}      1,934       28.12       85.65
{txt}          3 {c |}{res}        987       14.35      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}      6,878      100.00
{txt}
{com}. 
. 
. * loop over weighting options
. *----------------------------
.         
. local i = 1
{txt}
{com}. foreach weight in "[aw=weight]" " " {c -(}
{txt}  2{com}. 
. 
. * 1993
. *-----
. 
. local year = 1993
{txt}  3{com}. 
.                 
.         * capture relationship between education and vote share
.         *------------------------------------------------------         
. 
.         tempfile dif`year'_`i'
{txt}  4{com}.         reg voteAD_`year' educ1-educ4 if educ ~= . & year == `year' `weight', nocons r
{txt}  5{com}.         lincomest 100*(_b[educ4] - _b[educ1])
{txt}  6{com}.                 parmest, saving(`dif`year'_`i'') idstr("dif`year'_`i'") level(95)
{txt}  7{com}. 
. 
. 
. * 1998-2006
. *----------
. 
. foreach year in 1998 2000 2006 {c -(}
{txt}  8{com}. 
.         
.         * capture relationship between education and vote share
.         *------------------------------------------------------         
. 
.         reg chavez educ1-educ4 if educ ~= . & year == `year' `weight', nocons r
{txt}  9{com}.         tempfile dif`year'_`i'
{txt} 10{com}.                 lincomest 100*(_b[educ4] - _b[educ1])
{txt} 11{com}.                 parmest, saving(`dif`year'_`i'') idstr("dif`year'_`i'") level(95)
{txt} 12{com}. 
.         {c )-}
{txt} 13{com}. 
. * close loop over weights
. *------------------------
. 
. local i = `i' + 1
{txt} 14{com}. {c )-}
{txt}(sum of wgt is 653.7026451826096)

Linear regression                               Number of obs     = {res}       633
                                                {txt}F(4, 629)         =  {res}    42.66
                                                {txt}Prob > F          = {res}    0.0000
                                                {txt}R-squared         = {res}    0.2211
                                                {txt}Root MSE          =    {res} .40698

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 14}{c |}{col 26}    Robust
{col 1} voteAD_1993{col 14}{c |} Coefficient{col 26}  std. err.{col 38}      t{col 46}   P>|t|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 7}educ1 {c |}{col 14}{res}{space 2} .3131313{col 26}{space 2} .0467583{col 37}{space 1}    6.70{col 46}{space 3}0.000{col 54}{space 4}   .22131{col 67}{space 3} .4049526
{txt}{space 7}educ2 {c |}{col 14}{res}{space 2} .2042683{col 26}{space 2} .0223318{col 37}{space 1}    9.15{col 46}{space 3}0.000{col 54}{space 4} .1604144{col 67}{space 3} .2481222
{txt}{space 7}educ3 {c |}{col 14}{res}{space 2}   .15625{col 26}{space 2} .0287961{col 37}{space 1}    5.43{col 46}{space 3}0.000{col 54}{space 4} .0997019{col 67}{space 3} .2127981
{txt}{space 7}educ4 {c |}{col 14}{res}{space 2} .2173913{col 26}{space 2} .0610086{col 37}{space 1}    3.56{col 46}{space 3}0.000{col 54}{space 4} .0975861{col 67}{space 3} .3371965
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}{txt}Confidence interval for formula:
{res}100*(_b[educ4]-_b[educ1])

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1} voteAD_1993{col 14}{c |} Coefficient{col 26}  Std. err.{col 38}      t{col 46}   P>|t|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 9}(1) {c |}{col 14}{res}{space 2}-9.574001{col 26}{space 2} 7.686606{col 37}{space 1}   -1.25{col 46}{space 3}0.213{col 54}{space 4}-24.66852{col 67}{space 3} 5.520514
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{p 0 4 2}
file {bf}
/var/folders/b_/14sh0g7d0294l0trnz839fn1d84l60/T//S_55310.00000c{rm}
saved
as .dta format
{p_end}
(sum of wgt is 1,315.99861398339)

Linear regression                               Number of obs     = {res}     1,329
                                                {txt}F(4, 1325)        =  {res}   204.31
                                                {txt}Prob > F          = {res}    0.0000
                                                {txt}R-squared         = {res}    0.3994
                                                {txt}Root MSE          =    {res} .48741

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 14}{c |}{col 26}    Robust
{col 1}      chavez{col 14}{c |} Coefficient{col 26}  std. err.{col 38}      t{col 46}   P>|t|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 7}educ1 {c |}{col 14}{res}{space 2} .3276006{col 26}{space 2} .0372317{col 37}{space 1}    8.80{col 46}{space 3}0.000{col 54}{space 4} .2545611{col 67}{space 3} .4006401
{txt}{space 7}educ2 {c |}{col 14}{res}{space 2} .4395806{col 26}{space 2}  .022449{col 37}{space 1}   19.58{col 46}{space 3}0.000{col 54}{space 4} .3955411{col 67}{space 3}   .48362
{txt}{space 7}educ3 {c |}{col 14}{res}{space 2} .3602958{col 26}{space 2} .0278624{col 37}{space 1}   12.93{col 46}{space 3}0.000{col 54}{space 4} .3056366{col 67}{space 3} .4149551
{txt}{space 7}educ4 {c |}{col 14}{res}{space 2} .3880529{col 26}{space 2} .0282147{col 37}{space 1}   13.75{col 46}{space 3}0.000{col 54}{space 4} .3327025{col 67}{space 3} .4434033
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}{txt}Confidence interval for formula:
{res}100*(_b[educ4]-_b[educ1])

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1}      chavez{col 14}{c |} Coefficient{col 26}  Std. err.{col 38}      t{col 46}   P>|t|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 9}(1) {c |}{col 14}{res}{space 2}  6.04523{col 26}{space 2} 4.671476{col 37}{space 1}    1.29{col 46}{space 3}0.196{col 54}{space 4}-3.119067{col 67}{space 3} 15.20953
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{p 0 4 2}
file {bf}
/var/folders/b_/14sh0g7d0294l0trnz839fn1d84l60/T//S_55310.00000d{rm}
saved
as .dta format
{p_end}
(sum of wgt is 1,135.28632459044)

Linear regression                               Number of obs     = {res}     1,208
                                                {txt}F(4, 1204)        =  {res}   426.16
                                                {txt}Prob > F          = {res}    0.0000
                                                {txt}R-squared         = {res}    0.6147
                                                {txt}Root MSE          =    {res} .48673

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 14}{c |}{col 26}    Robust
{col 1}      chavez{col 14}{c |} Coefficient{col 26}  std. err.{col 38}      t{col 46}   P>|t|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 7}educ1 {c |}{col 14}{res}{space 2} .6083635{col 26}{space 2} .0524622{col 37}{space 1}   11.60{col 46}{space 3}0.000{col 54}{space 4} .5054361{col 67}{space 3} .7112909
{txt}{space 7}educ2 {c |}{col 14}{res}{space 2} .6470686{col 26}{space 2} .0227178{col 37}{space 1}   28.48{col 46}{space 3}0.000{col 54}{space 4} .6024977{col 67}{space 3} .6916395
{txt}{space 7}educ3 {c |}{col 14}{res}{space 2} .5597067{col 26}{space 2} .0252878{col 37}{space 1}   22.13{col 46}{space 3}0.000{col 54}{space 4} .5100936{col 67}{space 3} .6093197
{txt}{space 7}educ4 {c |}{col 14}{res}{space 2} .5986882{col 26}{space 2} .0365024{col 37}{space 1}   16.40{col 46}{space 3}0.000{col 54}{space 4} .5270728{col 67}{space 3} .6703036
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}{txt}Confidence interval for formula:
{res}100*(_b[educ4]-_b[educ1])

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1}      chavez{col 14}{c |} Coefficient{col 26}  Std. err.{col 38}      t{col 46}   P>|t|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 9}(1) {c |}{col 14}{res}{space 2} -.967529{col 26}{space 2} 6.391169{col 37}{space 1}   -0.15{col 46}{space 3}0.880{col 54}{space 4} -13.5066{col 67}{space 3} 11.57154
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{p 0 4 2}
file {bf}
/var/folders/b_/14sh0g7d0294l0trnz839fn1d84l60/T//S_55310.00000e{rm}
saved
as .dta format
{p_end}
(sum of wgt is 864.0298505425453)

Linear regression                               Number of obs     = {res}       873
                                                {txt}F(4, 869)         =  {res}   708.95
                                                {txt}Prob > F          = {res}    0.0000
                                                {txt}R-squared         = {res}    0.7518
                                                {txt}Root MSE          =    {res} .43139

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 14}{c |}{col 26}    Robust
{col 1}      chavez{col 14}{c |} Coefficient{col 26}  std. err.{col 38}      t{col 46}   P>|t|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 7}educ1 {c |}{col 14}{res}{space 2} .8428897{col 26}{space 2} .0332445{col 37}{space 1}   25.35{col 46}{space 3}0.000{col 54}{space 4} .7776408{col 67}{space 3} .9081387
{txt}{space 7}educ2 {c |}{col 14}{res}{space 2} .7774681{col 26}{space 2} .0199742{col 37}{space 1}   38.92{col 46}{space 3}0.000{col 54}{space 4} .7382647{col 67}{space 3} .8166714
{txt}{space 7}educ3 {c |}{col 14}{res}{space 2} .6951084{col 26}{space 2} .0327383{col 37}{space 1}   21.23{col 46}{space 3}0.000{col 54}{space 4}  .630853{col 67}{space 3} .7593638
{txt}{space 7}educ4 {c |}{col 14}{res}{space 2} .6642916{col 26}{space 2}   .04408{col 37}{space 1}   15.07{col 46}{space 3}0.000{col 54}{space 4} .5777759{col 67}{space 3} .7508074
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}{txt}Confidence interval for formula:
{res}100*(_b[educ4]-_b[educ1])

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1}      chavez{col 14}{c |} Coefficient{col 26}  Std. err.{col 38}      t{col 46}   P>|t|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 9}(1) {c |}{col 14}{res}{space 2}-17.85981{col 26}{space 2} 5.521092{col 37}{space 1}   -3.23{col 46}{space 3}0.001{col 54}{space 4}-28.69604{col 67}{space 3}-7.023575
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{p 0 4 2}
file {bf}
/var/folders/b_/14sh0g7d0294l0trnz839fn1d84l60/T//S_55310.00000f{rm}
saved
as .dta format
{p_end}

Linear regression                               Number of obs     = {res}       633
                                                {txt}F(4, 629)         =  {res}    42.66
                                                {txt}Prob > F          = {res}    0.0000
                                                {txt}R-squared         = {res}    0.2216
                                                {txt}Root MSE          =    {res}  .4057

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 14}{c |}{col 26}    Robust
{col 1} voteAD_1993{col 14}{c |} Coefficient{col 26}  std. err.{col 38}      t{col 46}   P>|t|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 7}educ1 {c |}{col 14}{res}{space 2} .3131313{col 26}{space 2} .0467583{col 37}{space 1}    6.70{col 46}{space 3}0.000{col 54}{space 4}   .22131{col 67}{space 3} .4049526
{txt}{space 7}educ2 {c |}{col 14}{res}{space 2} .2042683{col 26}{space 2} .0223318{col 37}{space 1}    9.15{col 46}{space 3}0.000{col 54}{space 4} .1604144{col 67}{space 3} .2481222
{txt}{space 7}educ3 {c |}{col 14}{res}{space 2}   .15625{col 26}{space 2} .0287961{col 37}{space 1}    5.43{col 46}{space 3}0.000{col 54}{space 4} .0997019{col 67}{space 3} .2127981
{txt}{space 7}educ4 {c |}{col 14}{res}{space 2} .2173913{col 26}{space 2} .0610086{col 37}{space 1}    3.56{col 46}{space 3}0.000{col 54}{space 4} .0975861{col 67}{space 3} .3371965
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}{txt}Confidence interval for formula:
{res}100*(_b[educ4]-_b[educ1])

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1} voteAD_1993{col 14}{c |} Coefficient{col 26}  Std. err.{col 38}      t{col 46}   P>|t|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 9}(1) {c |}{col 14}{res}{space 2}-9.574001{col 26}{space 2} 7.686606{col 37}{space 1}   -1.25{col 46}{space 3}0.213{col 54}{space 4}-24.66852{col 67}{space 3} 5.520514
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{p 0 4 2}
file {bf}
/var/folders/b_/14sh0g7d0294l0trnz839fn1d84l60/T//S_55310.00000g{rm}
saved
as .dta format
{p_end}

Linear regression                               Number of obs     = {res}     1,329
                                                {txt}F(4, 1325)        =  {res}   225.93
                                                {txt}Prob > F          = {res}    0.0000
                                                {txt}R-squared         = {res}    0.4068
                                                {txt}Root MSE          =    {res}  .4894

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 14}{c |}{col 26}    Robust
{col 1}      chavez{col 14}{c |} Coefficient{col 26}  std. err.{col 38}      t{col 46}   P>|t|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 7}educ1 {c |}{col 14}{res}{space 2} .3540373{col 26}{space 2} .0377459{col 37}{space 1}    9.38{col 46}{space 3}0.000{col 54}{space 4}  .279989{col 67}{space 3} .4280855
{txt}{space 7}educ2 {c |}{col 14}{res}{space 2} .4524715{col 26}{space 2} .0217351{col 37}{space 1}   20.82{col 46}{space 3}0.000{col 54}{space 4} .4098326{col 67}{space 3} .4951103
{txt}{space 7}educ3 {c |}{col 14}{res}{space 2} .3639241{col 26}{space 2} .0271063{col 37}{space 1}   13.43{col 46}{space 3}0.000{col 54}{space 4}  .310748{col 67}{space 3} .4171001
{txt}{space 7}educ4 {c |}{col 14}{res}{space 2} .3834356{col 26}{space 2}   .02697{col 37}{space 1}   14.22{col 46}{space 3}0.000{col 54}{space 4}  .330527{col 67}{space 3} .4363442
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}{txt}Confidence interval for formula:
{res}100*(_b[educ4]-_b[educ1])

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1}      chavez{col 14}{c |} Coefficient{col 26}  Std. err.{col 38}      t{col 46}   P>|t|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 9}(1) {c |}{col 14}{res}{space 2} 2.939832{col 26}{space 2} 4.639111{col 37}{space 1}    0.63{col 46}{space 3}0.526{col 54}{space 4}-6.160972{col 67}{space 3} 12.04064
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{p 0 4 2}
file {bf}
/var/folders/b_/14sh0g7d0294l0trnz839fn1d84l60/T//S_55310.00000h{rm}
saved
as .dta format
{p_end}

Linear regression                               Number of obs     = {res}     1,208
                                                {txt}F(4, 1204)        =  {res}   495.91
                                                {txt}Prob > F          = {res}    0.0000
                                                {txt}R-squared         = {res}    0.6204
                                                {txt}Root MSE          =    {res} .48495

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 14}{c |}{col 26}    Robust
{col 1}      chavez{col 14}{c |} Coefficient{col 26}  std. err.{col 38}      t{col 46}   P>|t|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 7}educ1 {c |}{col 14}{res}{space 2} .6170213{col 26}{space 2}  .050222{col 37}{space 1}   12.29{col 46}{space 3}0.000{col 54}{space 4}  .518489{col 67}{space 3} .7155536
{txt}{space 7}educ2 {c |}{col 14}{res}{space 2} .6659919{col 26}{space 2} .0212554{col 37}{space 1}   31.33{col 46}{space 3}0.000{col 54}{space 4} .6242901{col 67}{space 3} .7076937
{txt}{space 7}educ3 {c |}{col 14}{res}{space 2} .5717647{col 26}{space 2} .0240423{col 37}{space 1}   23.78{col 46}{space 3}0.000{col 54}{space 4} .5245953{col 67}{space 3} .6189341
{txt}{space 7}educ4 {c |}{col 14}{res}{space 2} .5948718{col 26}{space 2} .0352136{col 37}{space 1}   16.89{col 46}{space 3}0.000{col 54}{space 4} .5257849{col 67}{space 3} .6639587
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}{txt}Confidence interval for formula:
{res}100*(_b[educ4]-_b[educ1])

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1}      chavez{col 14}{c |} Coefficient{col 26}  Std. err.{col 38}      t{col 46}   P>|t|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 9}(1) {c |}{col 14}{res}{space 2}-2.214948{col 26}{space 2} 6.133715{col 37}{space 1}   -0.36{col 46}{space 3}0.718{col 54}{space 4}-14.24891{col 67}{space 3} 9.819009
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{p 0 4 2}
file {bf}
/var/folders/b_/14sh0g7d0294l0trnz839fn1d84l60/T//S_55310.00000i{rm}
saved
as .dta format
{p_end}

Linear regression                               Number of obs     = {res}       892
                                                {txt}F(4, 888)         =  {res}   729.98
                                                {txt}Prob > F          = {res}    0.0000
                                                {txt}R-squared         = {res}    0.7583
                                                {txt}Root MSE          =    {res} .42801

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 14}{c |}{col 26}    Robust
{col 1}      chavez{col 14}{c |} Coefficient{col 26}  std. err.{col 38}      t{col 46}   P>|t|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 7}educ1 {c |}{col 14}{res}{space 2} .8442623{col 26}{space 2} .0329027{col 37}{space 1}   25.66{col 46}{space 3}0.000{col 54}{space 4} .7796862{col 67}{space 3} .9088384
{txt}{space 7}educ2 {c |}{col 14}{res}{space 2} .7760181{col 26}{space 2}  .019875{col 37}{space 1}   39.04{col 46}{space 3}0.000{col 54}{space 4} .7370106{col 67}{space 3} .8150256
{txt}{space 7}educ3 {c |}{col 14}{res}{space 2} .7047619{col 26}{space 2} .0315481{col 37}{space 1}   22.34{col 46}{space 3}0.000{col 54}{space 4} .6428443{col 67}{space 3} .7666795
{txt}{space 7}educ4 {c |}{col 14}{res}{space 2} .6694915{col 26}{space 2} .0434009{col 37}{space 1}   15.43{col 46}{space 3}0.000{col 54}{space 4} .5843112{col 67}{space 3} .7546718
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}{txt}Confidence interval for formula:
{res}100*(_b[educ4]-_b[educ1])

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1}      chavez{col 14}{c |} Coefficient{col 26}  Std. err.{col 38}      t{col 46}   P>|t|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 9}(1) {c |}{col 14}{res}{space 2}-17.47708{col 26}{space 2} 5.446308{col 37}{space 1}   -3.21{col 46}{space 3}0.001{col 54}{space 4}-28.16621{col 67}{space 3}-6.787941
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{p 0 4 2}
file {bf}
/var/folders/b_/14sh0g7d0294l0trnz839fn1d84l60/T//S_55310.00000j{rm}
saved
as .dta format
{p_end}

{com}.         
. 
. 
.         
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.         
. 
. 
. *-------------------------------------------------------------------------------
. * 2012
. *-------------------------------------------------------------------------------
. 
. 
. * raw LAPOP data
. *---------------
. 
. use "data/inputs/Survey2012_LAPOP.dta", clear
{txt}(All data are copyrighted by LAPOP. For more info, run the command note list)

{com}. 
. 
. * vote intention
. *---------------
. 
. gen chavez = .
{txt}(1,500 missing values generated)

{com}. replace chavez = 1 if vote2012 == 2
{txt}(601 real changes made)

{com}. replace chavez = 0 if vote2012 == 3     
{txt}(351 real changes made)

{com}. 
. 
. * Education groups
. *-----------------
. 
. gen educ = "No primary" if educ_original < 6
{txt}(1,409 missing values generated)

{com}. replace educ = "Primary complete" if educ_original >= 6 & educ_original < 11
{txt}variable {bf}{res}educ{sf}{txt} was {bf}{res}str10{sf}{txt} now {bf}{res}str16{sf}
{txt}(532 real changes made)

{com}. replace educ = "Secondary complete" if educ_original >= 11 & educ_original < 15
{txt}variable {bf}{res}educ{sf}{txt} was {bf}{res}str16{sf}{txt} now {bf}{res}str18{sf}
{txt}(556 real changes made)

{com}. replace educ = "Tertiary complete" if educ_original >= 15 & educ_original ~= .a & educ_original ~= .b
{txt}(304 real changes made)

{com}. tab educ, gen(educ)

              {txt}educ {c |}      Freq.     Percent        Cum.
{hline 19}{c +}{hline 35}
        No primary {c |}{res}         91        6.14        6.14
{txt}  Primary complete {c |}{res}        532       35.87       42.01
{txt}Secondary complete {c |}{res}        556       37.49       79.50
{txt} Tertiary complete {c |}{res}        304       20.50      100.00
{txt}{hline 19}{c +}{hline 35}
             Total {c |}{res}      1,483      100.00
{txt}
{com}. 
. 
. * year
. *-----
.         
. local year = 2012       
{txt}
{com}.         
.         
.         * capture relationship between education and vote share
.         *------------------------------------------------------         
. 
.         reg chavez educ1-educ4 if educ ~= "", nocons r

{txt}Linear regression                               Number of obs     = {res}       940
                                                {txt}F(4, 936)         =  {res}   431.68
                                                {txt}Prob > F          = {res}    0.0000
                                                {txt}R-squared         = {res}    0.6410
                                                {txt}Root MSE          =    {res} .47693

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 14}{c |}{col 26}    Robust
{col 1}      chavez{col 14}{c |} Coefficient{col 26}  std. err.{col 38}      t{col 46}   P>|t|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 7}educ1 {c |}{col 14}{res}{space 2} .7619048{col 26}{space 2} .0537751{col 37}{space 1}   14.17{col 46}{space 3}0.000{col 54}{space 4}  .656371{col 67}{space 3} .8674385
{txt}{space 7}educ2 {c |}{col 14}{res}{space 2} .7058824{col 26}{space 2} .0247636{col 37}{space 1}   28.50{col 46}{space 3}0.000{col 54}{space 4} .6572838{col 67}{space 3} .7544809
{txt}{space 7}educ3 {c |}{col 14}{res}{space 2}       .6{col 26}{space 2} .0270256{col 37}{space 1}   22.20{col 46}{space 3}0.000{col 54}{space 4} .5469623{col 67}{space 3} .6530377
{txt}{space 7}educ4 {c |}{col 14}{res}{space 2} .5169082{col 26}{space 2} .0348067{col 37}{space 1}   14.85{col 46}{space 3}0.000{col 54}{space 4} .4486001{col 67}{space 3} .5852163
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}{txt}
{com}.         lincomest 100*(_b[educ4] - _b[educ1])   
{txt}Confidence interval for formula:
{res}100*(_b[educ4]-_b[educ1])

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1}      chavez{col 14}{c |} Coefficient{col 26}  Std. err.{col 38}      t{col 46}   P>|t|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 9}(1) {c |}{col 14}{res}{space 2}-24.49965{col 26}{space 2} 6.405675{col 37}{space 1}   -3.82{col 46}{space 3}0.000{col 54}{space 4} -37.0708{col 67}{space 3}-11.92851
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}

{com}.                 tempfile dif`year'
{txt}
{com}.                 parmest, saving(`dif`year'') idstr("dif`year'") level(95)
{txt}{p 0 4 2}
file {bf}
/var/folders/b_/14sh0g7d0294l0trnz839fn1d84l60/T//S_55310.00000k{rm}
saved
as .dta format
{p_end}

{com}.         
. 
. 
.         
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.         
. 
. 
. *-------------------------------------------------------------------------------
. * append results and save
. *-------------------------------------------------------------------------------
. 
. 
. * difference of interest
. *-----------------------
. 
. clear
{txt}
{com}.         foreach edgroup in Baseline Tertiary {c -(}
{txt}  2{com}.         forvalues year = 1958(5)1973 {c -(}
{txt}  3{com}.         di "dif`year'_`edgroup'"
{txt}  4{com}.         append using `dif`year'_`edgroup''
{txt}  5{com}.         {c )-}
{txt}  6{com}.         {c )-}
dif1958_Baseline
dif1963_Baseline
dif1968_Baseline
dif1973_Baseline
dif1958_Tertiary
dif1963_Tertiary
dif1968_Tertiary
dif1973_Tertiary
{txt}
{com}.         
. foreach year of numlist 1978(5)1988 2012 {c -(}
{txt}  2{com}.         append using `dif`year''
{txt}  3{com}. {c )-}
{txt}
{com}. 
. foreach year of numlist 1993 1998 2000 2006 {c -(}
{txt}  2{com}.         append using `dif`year'_1'
{txt}  3{com}.         di "dif`year'_2"
{txt}  4{com}.         append using `dif`year'_2'
{txt}  5{com}. {c )-}       
dif1993_2
dif1998_2
dif2000_2
dif2006_2
{txt}
{com}. 
. 
. * save data for appendix table
. *-----------------------------
. 
. preserve
{txt}
{com}. gen version = "Baseline" if regexm(idstr, "Tertiary") == 0 & regexm(idstr, "_1") == 0
{txt}(8 missing values generated)

{com}. replace version = "Tertiary" if regexm(idstr, "Tertiary")
{txt}(4 real changes made)

{com}. replace version = "Weighted" if regexm(idstr, "_1")
{txt}(4 real changes made)

{com}. keep idstr estimate version
{txt}
{com}. replace idstr = subinstr(idstr, "_1", "", .)
{txt}(4 real changes made)

{com}. replace idstr = subinstr(idstr, "_2", "", .)
{txt}(4 real changes made)

{com}. destring idstr, replace ignore("dif" "_Baseline" "_Tertiary")
{txt}idstr: characters{res} d i f _ B a s e l n T r t y{txt} removed; {res}replaced {txt}as {res}int
{txt}
{com}. reshape wide estimate, i(version) j(idstr)
{txt}(j = 1958 1963 1968 1973 1978 1983 1988 1993 1998 2000 2006 2012)

Data{col 36}Long{col 43}->{col 48}Wide
{hline 77}
Number of observations     {res}          20   {txt}->   {res}3           
{txt}Number of variables        {res}           3   {txt}->   {res}13          
{txt}j variable (12 values)            {res}idstr   {txt}->   (dropped)
xij variables:
                               {res}estimate   {txt}->   {res}estimate1958 estimate1963 ... estimate2012
{txt}{hline 77}

{com}. save "data/outputs/EducAlternativesAppendix.dta", replace
{txt}{p 0 4 2}
file {bf}
data/outputs/EducAlternativesAppendix.dta{rm}
saved
{p_end}

{com}. restore
{txt}
{com}. 
. 
. * save for main graph
. *--------------------
. 
. rename idstr year
{res}{txt}
{com}. drop if regexm(year, "Tertiary") | regexm(year, "_1")
{txt}(8 observations deleted)

{com}. replace year = subinstr(year, "_2", "", .)
{txt}(4 real changes made)

{com}. destring year, ignore("dif" "_Baseline") replace
{txt}year: characters{res} d i f _ B a s e l n{txt} removed; {res}replaced {txt}as {res}int
{txt}
{com}. save "data/outputs/EducMstr.dta", replace
{txt}{p 0 4 2}
file {bf}
data/outputs/EducMstr.dta{rm}
saved
{p_end}

{com}. 
. 
. * End   
. 
{txt}end of do-file

{com}.         
. do "code_Stata/1_Figure1.do"
{txt}
{com}. 
. * data
. use "data/inputs/MunicipioData_AD_Chavez.dta", clear
{txt}
{com}. 
. * save correlation with AD 1958
. mat results = J(11, 2, 0)
{txt}
{com}. local i = 1
{txt}
{com}. foreach year of numlist 1963(5)1998 2000(6)2012 {c -(}
{txt}  2{com}.         cap cor share_presAD1958 share_presAD`year'
{txt}  3{com}.         if _rc == 0 {c -(}
{txt}  4{com}.         mat results[`i',1] = `year'
{txt}  5{com}.         mat results[`i',2] = `r(rho)'
{txt}  6{com}.         {c )-}
{txt}  7{com}.         else {c -(}
{txt}  8{com}.         cor share_presAD1958 share_presOFIC`year'
{txt}  9{com}.         mat results[`i',1] = `year'
{txt} 10{com}.         mat results[`i',2] = `r(rho)'
{txt} 11{com}.         {c )-}
{txt} 12{com}.         local i = `i' + 1
{txt} 13{com}. {c )-}
{txt}(obs=287)

             {c |} sha~1958 sha~1998
{hline 13}{c +}{hline 18}
share_p~1958 {c |}{res}   1.0000
{txt}share_p~1998 {c |}{res}  -0.0174   1.0000

{txt}(obs=287)

             {c |} sha~1958 sha~2000
{hline 13}{c +}{hline 18}
share_p~1958 {c |}{res}   1.0000
{txt}share_p~2000 {c |}{res}   0.0761   1.0000

{txt}(obs=287)

             {c |} sha~1958 sha~2006
{hline 13}{c +}{hline 18}
share_p~1958 {c |}{res}   1.0000
{txt}share_p~2006 {c |}{res}   0.3571   1.0000

{txt}(obs=287)

             {c |} sha~1958 sha~2012
{hline 13}{c +}{hline 18}
share_p~1958 {c |}{res}   1.0000
{txt}share_p~2012 {c |}{res}   0.4364   1.0000

{txt}
{com}. 
. * use results
. clear 
{txt}
{com}. svmat results
{txt}number of observations will be reset to 11
Press any key to continue, or Break to abort
{p}
Number of observations ({bf:_N}) was 0,
now 11.
{p_end}

{com}. rename results1 year
{res}{txt}
{com}. rename results2 cor1958
{res}{txt}
{com}. 
. * Figure 1
. #delimit;
{txt}delimiter now ;
{com}. twoway (connected cor1958 year if year > 1958, 
>             lcolor(white) mcolor(white) 
>             mlwidth(thick) mlcolor(white) msize(large))
>                 
>            (connected cor1958 year if year >= 1963 & year <= 2012, 
>             lcolor(black) mcolor(black) lwidth(medthick)
>             mlwidth(thick) mlcolor(white) msize(large))
>                 
>            (scatter cor1958 year if year == 1963, 
>             mcolor(black) 
>             mlwidth(thick) mlcolor(white) msize(large))
>                 
>            (scatter cor1958 year if year >= 1998 & year <= 2012, 
>             lcolor(black) mcolor(black) lwidth(medthick) msymbol(diamond)
>             mlwidth(thick) mlcolor(white) msize(large))
>                 
>            (scatter cor1958 year if year == 1998, 
>             lcolor(black) mcolor(blue) msymbol(diamond)
>             mlwidth(thick) mlcolor(white) msize(large)),
> 
>                 yline(0, lwidth(thick) lcolor(gs12))
>                 graphregion(fcolor(white) lcolor(white) margin(zero))
>         plotregion(fcolor(white) lstyle(none) lcolor(white) ilstyle(none))
>         xsize(11) ysize(7.75)   
>                 title("", size(large))
>                 ytitle("Correlation with 1958 AD vote share", color(black) size(large))
>                 xtitle("")
>                 yscale()
>                 ylabel(-.2(.2)1, labsize(large) glcolor(white) angle(horizontal))
>                 xlabel(1958 "1958"
>                 1968 "1968"
>                 1978 "1978"
>                 1988 "1988"
>                 1998 "98  "
>                 2000 "  00"
>                 2006 "2006"
>                 2012 "2012", labsize(large))
>                 xscale( range(1958 2014))
>         legend(order(3 "AD vs. AD 1958" 4 "Chávez vs. AD 1958") pos(8) ring(0) rows(2)                   region(lcolor(white)));
{res}{txt}
{com}. graph export "figures/Figure1.pdf", replace;
{txt}{p 0 4 2}
file {bf}
/Users/kronick/Riker/Replication/figures/Figure1.pdf{rm}
saved as
PDF
format
{p_end}

{com}. * End

{txt}end of do-file

{com}. do "code_Stata/2_Figure2.do"
{txt}
{com}. 
. * data
. use "data/inputs/MunicipioData_AD_Chavez.dta", clear
{txt}
{com}. 
. * reshape
. reshape long share_pres, i(estado municipio) j(year, string)
{txt}(j = AD1958 AD1963 AD1968 AD1973 AD1978 AD1983 AD1988 AD1993 OFIC1998 OFIC2000 OFIC2006 OFIC2012)
share_presAD1993:  {res}282{txt} values would be changed; not changed

Data{col 36}Wide{col 43}->{col 48}Long
{hline 77}
Number of observations     {res}         290   {txt}->   {res}3,480       
{txt}Number of variables        {res}          38   {txt}->   {res}28          
{txt}j variable (12 values)                    ->   {res}year
{txt}xij variables:
{res}share_presAD1958 share_presAD1963 ... share_presOFIC2012{txt}->{res}share_pres
{txt}{hline 77}

{com}. gen party = "AD" if regexm(year, "AD")
{txt}(1,160 missing values generated)

{com}. replace party = "OFIC" if regexm(year, "OFIC")
{txt}variable {bf}{res}party{sf}{txt} was {bf}{res}str2{sf}{txt} now {bf}{res}str4{sf}
{txt}(1,160 real changes made)

{com}. destring year, ignore("AD" "OFIC") replace
{txt}year: characters{res} A D O F I C{txt} removed; {res}replaced {txt}as {res}int
{txt}
{com}. 
. * rank
. egen obs = count(share_pres), by(year)
{txt}
{com}. sort year share_pres
{txt}
{com}. by year: gen rank = _n
{txt}
{com}. gen percentile = rank / obs
{txt}
{com}. 
. * Unión
. #delimit;
{txt}delimiter now ;
{com}. twoway  (line percentile year if municipio == "Unión" & estado == "Falcón",
>                  lcolor(black) lwidth(medthick))
>                 (line percentile year if municipio == "Unión" & estado == "Falcón" 
>                 & year >= 1993 & year <= 2000,
>                  lcolor(blue) lwidth(medthick))
>             (scatter percentile year if municipio == "Unión" & estado == "Falcón" 
>                  & year < 1998, mcolor(black) 
>             mlwidth(thick) mlcolor(white) msize(large)) 
>                 (scatter percentile year if municipio == "Unión" & estado == "Falcón" 
>                  & year >= 1998, mcolor(black) msymbol(diamond)
>             mlwidth(thick) mlcolor(white) msize(large))
>             (scatter percentile year if municipio == "Unión" & estado == "Falcón" 
>                  & year == 1998, mcolor(blue) msymbol(diamond)
>             mlwidth(thick) mlcolor(white) msize(large)) ,               
>                 graphregion(fcolor(white) lcolor(white) margin(zero))
>         plotregion(fcolor(white) lstyle(none) lcolor(white) ilstyle(none))
>         xsize(3) ysize(3)
>                 title("", size(large))
>                 ytitle("Vote Share Percentile", color(black) size(large))
>                 xtitle("")
>                 ylabel(0(.2)1, labsize(large) glcolor(black%10) glwidth(thin) angle(horizontal))
>                 xlabel(1958 "1958"
>                 1968 "1968"
>                 1978 "1978"
>                 1988 "1988"
>                 1998 "98   "
>                 2000 "   00"
>                 2012 "2012", labsize(large))
>                 xscale( range(1958 2014))
>         legend(off);
{res}{txt}
{com}. graph export "figures/Figure2a.pdf", replace;
{txt}{p 0 4 2}
file {bf}
/Users/kronick/Riker/Replication/figures/Figure2a.pdf{rm}
saved as
PDF
format
{p_end}

{com}. * Maracaibo
> #delimit;
. twoway  (line percentile year if municipio == "Maracaibo" & estado == "Zulia",
>                  lcolor(black) lwidth(medthick))
>                 (line percentile year if municipio == "Maracaibo" & estado == "Zulia" 
>                 & year >= 1993 & year <= 2000,
>                  lcolor(blue) lwidth(medthick)) 
>             (scatter percentile year if municipio == "Maracaibo" & estado == "Zulia" 
>                  & year < 1998, mcolor(black) 
>             mlwidth(thick) mlcolor(white) msize(large)) 
>                 (scatter percentile year if municipio == "Maracaibo" & estado == "Zulia" 
>                  & year >= 1998, mcolor(black) msymbol(diamond)
>             mlwidth(thick) mlcolor(white) msize(large))
>             (scatter percentile year if municipio == "Maracaibo" & estado == "Zulia" 
>                  & year == 1998, mcolor(blue) msymbol(diamond)
>             mlwidth(thick) mlcolor(white) msize(large)) ,               
>                 graphregion(fcolor(white) lcolor(white) margin(zero))
>         plotregion(fcolor(white) lstyle(none) lcolor(white) ilstyle(none))
>         xsize(3) ysize(3)
>                 title("", size(large))
>                 ytitle("", color(black) size(large))
>                 xtitle("")
>                 yscale(off range(0 1))
>                 ylabel(0(.2)1, glcolor(black%10) glwidth(thin))
>                 xlabel(1958 "1958"
>                 1968 "1968"
>                 1978 "1978"
>                 1988 "1988"
>                 1998 "98   "
>                 2000 "   00"
>                 2012 "2012", labsize(large))
>                 xscale( range(1956 2014))
>         legend(off);
{res}{txt}
{com}. graph export "figures/Figure2b.pdf", replace;
{txt}{p 0 4 2}
file {bf}
/Users/kronick/Riker/Replication/figures/Figure2b.pdf{rm}
saved as
PDF
format
{p_end}

{com}. * Rojas and Chacao
> #delimit;
. twoway  (line percentile year if municipio == "Chacao" & estado == "Miranda",
>                  lcolor(black) lwidth(medthick))
>                  
>                 (line percentile year if municipio == "Chacao" & estado == "Miranda" 
>                 & year >= 1993 & year <= 2000,
>                  lcolor(blue) lwidth(medthick)) 
>                  
>             (scatter percentile year if municipio == "Chacao" & estado == "Miranda"
>                 & year < 1998, mcolor(black) 
>             mlwidth(thick) mlcolor(white) msize(large)) 
>                 
>                 (scatter percentile year if municipio == "Chacao" & estado == "Miranda" 
>                  & year >= 1998, mcolor(black) msymbol(diamond)
>             mlwidth(thick) mlcolor(white) msize(large))
>                 
>             (scatter percentile year if municipio == "Chacao" & estado == "Miranda" 
>                  & year == 1998, mcolor(blue) msymbol(diamond)
>             mlwidth(thick) mlcolor(white) msize(large))
>                 
>                 (line percentile year if municipio == "Rojas" & estado == "Barinas",
>                  lcolor(black) lwidth(medthick))
>                  
>                 (line percentile year if municipio == "Rojas" & estado == "Barinas" 
>                 & year >= 1993 & year <= 2000,
>                  lcolor(blue) lwidth(medthick)) 
>                  
>             (scatter percentile year if municipio == "Rojas" & estado == "Barinas" 
>                  & year < 1998, mcolor(black) 
>             mlwidth(thick) mlcolor(white) msize(large)) 
>                 
>                 (scatter percentile year if municipio == "Rojas" & estado == "Barinas" 
>                  & year >= 1998, mcolor(black) msymbol(diamond)
>             mlwidth(thick) mlcolor(white) msize(large))
>                 
>                 (scatter percentile year if municipio == "Rojas" & estado == "Barinas" 
>                  & year == 1998, mcolor(blue) msymbol(diamond)
>             mlwidth(thick) mlcolor(white) msize(large)),
>                 
>                 graphregion(fcolor(white) lcolor(white) margin(zero))
>         plotregion(fcolor(white) lstyle(none) lcolor(white) ilstyle(none))
>         xsize(3) ysize(3)
>                 title("", size(large))
>                 ytitle("", color(black) size(large))
>                 xtitle("")
>         yscale(off range(0 1))
>                 ylabel(0(.2)1, glcolor(black%10) glwidth(thin))
>                 xlabel(1958 "1958"
>                 1968 "1968"
>                 1978 "1978"
>                 1988 "1988"
>                 1998 "98   "
>                 2000 "   00"
>                 2012 "2012", labsize(large))
>                 xscale( range(1956 2014))
>         legend(off);
{res}{txt}
{com}. graph export "figures/Figure2c.pdf", replace;
{txt}{p 0 4 2}
file {bf}
/Users/kronick/Riker/Replication/figures/Figure2c.pdf{rm}
saved as
PDF
format
{p_end}

{com}. * End
> 
> 

{txt}end of do-file

{com}. do "code_Stata/3_Figure3.do"
{txt}
{com}. 
. * data from 0a_PrepSurveyData.do
. use "data/outputs/EducMstr.dta", clear
{txt}
{com}. 
. 
. * graph, all years, 1998+2000 highlighted
. #delimit;
{txt}delimiter now ;
{com}. twoway  (scatter estimate year if year < 1998, mcolor(black))
>             (rbar min95 max95 year if year < 1998, color(black) barwidth(.2))
>                 (scatter estimate year if year > 2000, mcolor(black) msymbol(diamond))
>             (rbar min95 max95 year if year > 2000, color(black) barwidth(.2))
>                 (scatter estimate year if year <= 1968 | year == 1978, mcolor(gs10))
>             (rbar min95 max95 year if year <= 1968 | year == 1978, color(gs10) barwidth(.2))
>                 (scatter estimate year if year == 1998 | year == 2000, mcolor(blue) msymbol(diamond))
>             (rbar min95 max95 year if year == 1998 | year == 2000, color(blue) barwidth(.2)),
>                 yline(0, lwidth(thick) lcolor(gs12))
>                 graphregion(fcolor(white) lcolor(white) margin(zero))
>         plotregion(fcolor(white) lstyle(none) lcolor(white) ilstyle(none))
>         xsize(11) ysize(7.75)
>                 title("", size(large))
>         ytitle("Difference in P(Vote Left)", color(black) size(large))
>                 xtitle("")
>         yscale()
>                 ylabel(-30(10)10, labsize(large) glcolor(white))
>                 xlabel(1958 "1958"
>                 1968 "1968"
>                 1978 "1978"
>                 1988 "1988"
>                 1998 "98  "
>                 2000 "  00"
>                 2006 "2006"
>                 2012 "2012", labsize(large))
>                 xscale( range(1958 2014))
>         legend(order(1 "AD" 3 "Chávez") rows(2) region(lcolor(white)) pos(11) ring(0));
{res}{txt}
{com}. graph export "figures/Figure3.pdf", replace;
{txt}{p 0 4 2}
file {bf}
/Users/kronick/Riker/Replication/figures/Figure3.pdf{rm}
saved as
PDF
format
{p_end}

{com}. * End

{txt}end of do-file

{com}. do "code_Stata/4_Figure4.do"
{txt}
{com}. 
. * data          
. use "data/inputs/PrecinctData.dta", clear
{txt}
{com}. 
. * normalize
. egen mesascount = count(chavista), by(year)
{txt}
{com}. sort year nonmiss_twoprevyears
{txt}
{com}. by year: gen n = _n 
{txt}
{com}. gen pctile = n / mesascount
{txt}
{com}. 
. * graph for paper
. #delimit;
{txt}delimiter now ;
{com}. twoway  (lpolyci chavista pctile if year == 1998, 
>              lcolor(blue%50) lwidth(vthin) ciplot(rline) degree(1))
>                 (lpoly chavista pctile if year == 1998, lcolor(blue) degree(1))
>                 (lpolyci chavista pctile if year == 2000, 
>              lcolor(blue%30) lwidth(vthin) ciplot(rline) degree(1))
>                 (lpoly chavista pctile if year == 2000, lcolor(blue%70) degree(1))
>                 (lpolyci chavista pctile if year == 2006, 
>              lcolor(black%30) lwidth(vthin) ciplot(rline) degree(1))
>                 (lpoly chavista pctile if year == 2006, lcolor(black%50) degree(1))
>             (lpolyci chavista pctile if year == 2012, 
>              lcolor(black%50) lwidth(vthin) ciplot(rline) degree(1))
>                 (lpoly chavista pctile if year == 2012, lcolor(black) degree(1)),
>                 legend(off)
>                 graphregion(fcolor(white) lcolor(white) margin(zero))
>         plotregion(fcolor(white) lstyle(none) lcolor(white) ilstyle(none))
>         xsize(11) ysize(7.75)
>                 title("", size(large))
>                 ytitle("Chávez Vote Share", color(black) size(large))
>                 xtitle("Percentile of Distribution of Formal Employment", size(large))
>         yscale()
>                 ylabel(.3(.1).9, labsize(large) glcolor(white) angle(horizontal))
>                 xlabel(, labsize(large));
{res}{txt}
{com}. graph export "figures/Figure4.pdf", replace;
{txt}{p 0 4 2}
file {bf}
/Users/kronick/Riker/Replication/figures/Figure4.pdf{rm}
saved as
PDF
format
{p_end}

{com}. * End

{txt}end of do-file

{com}.         
. do "code_Stata/5_TableB1.do"
{txt}
{com}. 
. * Census data
. do "code_Stata/5a_TableB1_A.do"
{txt}
{com}. 
. 
. 
.         
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
. 
. *-------------------------------------------------------------------------------
. * 1961
. *-------------------------------------------------------------------------------
. 
. import delimited "data/inputs/Census1961.csv", clear 
{res}{txt}(encoding automatically selected: UTF-8)
{res}{text}(9 vars, 2 obs)

{com}. 
. gen MenosDePrimaria = (pob-prim-bachiller-licen)/pob
{txt}
{com}. gen Primaria = prim / pob
{txt}
{com}. gen Bachiller = bach / pob
{txt}
{com}. gen Licenciado = lic / pob
{txt}
{com}. 
. keep if year == 1961
{txt}(1 observation deleted)

{com}. keep year Menos Prim Bach Lic 
{txt}
{com}. 
. tempfile censo1961
{txt}
{com}. save `censo1961'
{txt}{p 0 4 2}
file {bf}
/var/folders/b_/14sh0g7d0294l0trnz839fn1d84l60/T//S_55310.000001{rm}
saved
as .dta format
{p_end}

{com}. 
. 
.         
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.         
. *-------------------------------------------------------------------------------
. * 1981
. *-------------------------------------------------------------------------------
. 
. 
. * First table
. *------------
. 
.         /* Note, this crosstab allows construction of
>            number of people with primary complete, secondary complete, etc.,
>            but does not include the denominator 
>            (i.e. does not include people with less than one year
>            of primary ed). We get the denominator from the next
>            table. */
. 
. 
. import excel "data/inputs/Census1981a.xlsx", sheet("Proc10 T_Dist") clear
{res}{text}(15 vars, 24 obs)

{com}. 
. * variable names
. drop in 1/12
{txt}(12 observations deleted)

{com}. compress
  {txt}variable {bf}{res}A{sf}{txt} was {bf}{res}str30{sf}{txt} now {bf}{res}str1{sf}
  {txt}variable {bf}{res}B{sf}{txt} was {bf}{res}str114{sf}{txt} now {bf}{res}str5{sf}
  {txt}variable {bf}{res}C{sf}{txt} was {bf}{res}str38{sf}{txt} now {bf}{res}str11{sf}
{txt}  (1,980 bytes saved)

{com}. foreach var of varlist C-F {c -(}
{txt}  2{com}.         local name = strtoname(`var'[1])
{txt}  3{com}.         rename `var' `name'
{txt}  4{com}.         {c )-}
{res}{txt}
{com}. drop in 1/1
{txt}(1 observation deleted)

{com}. rename B year_study
{res}{txt}
{com}. keep year-Total
{txt}
{com}. renvars *Primaria *Secundaria *Superior, predrop(4)
{txt}
{com}. destring year-Total, replace force
{txt}year_study: contains nonnumeric characters; {res}replaced {txt}as {res}byte
{txt}(2 missing values generated)
{res}{txt}Primaria: all characters numeric; {res}replaced {txt}as {res}long
{txt}(1 missing value generated)
{res}{txt}Secundaria: all characters numeric; {res}replaced {txt}as {res}long
{txt}(1 missing value generated)
{res}{txt}Superior: contains nonnumeric characters; {res}replaced {txt}as {res}long
{txt}(2 missing values generated)
{res}{txt}Total: all characters numeric; {res}replaced {txt}as {res}long
{txt}(1 missing value generated)
{res}{txt}
{com}. 
. * organize
. drop if year == .
{txt}(2 observations deleted)

{com}. drop Total
{txt}
{com}. gen year = 1981
{txt}
{com}. 
. * proportions of interest
. reshape wide Primaria Secundaria Superior, i(year) j(year_study)
{txt}(j = 1 2 3 4 5 6 7 8 9)

Data{col 36}Long{col 43}->{col 48}Wide
{hline 77}
Number of observations     {res}           9   {txt}->   {res}1           
{txt}Number of variables        {res}           5   {txt}->   {res}28          
{txt}j variable (9 values)        {res}year_study   {txt}->   (dropped)
xij variables:
                               {res}Primaria   {txt}->   {res}Primaria1 Primaria2 ... Primaria9
                             Secundaria   {txt}->   {res}Secundaria1 Secundaria2 ... Secundaria9
                               Superior   {txt}->   {res}Superior1 Superior2 ... Superior9
{txt}{hline 77}

{com}. order year Primaria* Secundaria* Superior*
{txt}
{com}. egen Primaria_Completa = rowtotal(Primaria6-Secundaria4)
{txt}
{com}. egen Secundaria_Completa = rowtotal(Secundaria5-Superior4)
{txt}
{com}. egen Superior_Completa = rowtotal(Superior5-Superior8)
{txt}
{com}. keep year *Completa
{txt}
{com}. 
. * save
. tempfile completa1981
{txt}
{com}. save `completa1981'
{txt}{p 0 4 2}
file {bf}
/var/folders/b_/14sh0g7d0294l0trnz839fn1d84l60/T//S_55310.000002{rm}
saved
as .dta format
{p_end}

{com}. 
. 
. * Second table
. *--------------
. 
.         /* Note, this crosstab does not have number 
>            of people with primary COMPLETE, but does 
>            allow construction of the denominator. 
>            */
.            
. import excel "data/inputs/Census1981b.xlsx", sheet("Proc1 T_Dist") clear
{res}{text}(15 vars, 112 obs)

{com}. 
. * variable names
. drop in 1/10
{txt}(10 observations deleted)

{com}. compress
  {txt}variable {bf}{res}A{sf}{txt} was {bf}{res}str30{sf}{txt} now {bf}{res}str1{sf}
  {txt}variable {bf}{res}B{sf}{txt} was {bf}{res}str111{sf}{txt} now {bf}{res}str5{sf}
  {txt}variable {bf}{res}C{sf}{txt} was {bf}{res}str38{sf}{txt} now {bf}{res}str10{sf}
{txt}  (16,626 bytes saved)

{com}. foreach var of varlist C-G {c -(}
{txt}  2{com}.         local name = strtoname(`var'[1])
{txt}  3{com}.         rename `var' `name'
{txt}  4{com}.         {c )-}
{res}{txt}
{com}. drop in 1/1
{txt}(1 observation deleted)

{com}. rename B age
{res}{txt}
{com}. keep age-Total
{txt}
{com}. destring age, replace force
{txt}age: contains nonnumeric characters; {res}replaced {txt}as {res}byte
{txt}(2 missing values generated)
{res}{txt}
{com}. drop if age == . /* Total lines */
{txt}(2 observations deleted)

{com}. renvars *Ninguno *Primaria *Secundaria *Superior, predrop(4)
{txt}
{com}. 
. * organize
. destring Ninguno-Total, replace force
{txt}Ninguno: all characters numeric; {res}replaced {txt}as {res}long
{txt}Primaria: all characters numeric; {res}replaced {txt}as {res}long
{txt}Secundaria: all characters numeric; {res}replaced {txt}as {res}long
{txt}Superior: contains nonnumeric characters; {res}replaced {txt}as {res}int
{txt}(4 missing values generated)
{res}{txt}Total: all characters numeric; {res}replaced {txt}as {res}long
{txt}
{com}. keep if age >= 18
{txt}(18 observations deleted)

{com}. collapse (sum) Total
{res}{txt}
{com}. gen year = 1981
{txt}
{com}. 
. 
. * Merge two tables
. *-----------------
. 
. merge 1:1 year using `completa1981'
{res}
{txt}{col 5}Result{col 33}Number of obs
{col 5}{hline 41}
{col 5}Not matched{col 30}{res}               0
{txt}{col 5}Matched{col 30}{res}               1{txt}  (_merge==3)
{col 5}{hline 41}

{com}. 
. 
. * Take total from second table and counts from first table
. *---------------------------------------------------------
. 
. * proportions
. gen MenosDePrimaria = Total - (Primaria_Completa + Secundaria_Completa + Superior_Completa)
{txt}
{com}. renvars *Completa, postdrop(9)
{txt}
{com}. foreach var of varlist MenosDePrimaria Primaria Secundaria Superior {c -(}
{txt}  2{com}.         gen p_`var' = `var' / Total
{txt}  3{com}.         {c )-}
{txt}
{com}. keep year p_*
{txt}
{com}. 
. * remame
. rename p_MenosDePrimaria MenosDePrimaria
{res}{txt}
{com}. rename p_Primaria Primaria
{res}{txt}
{com}. rename p_Secundaria Bachiller
{res}{txt}
{com}. rename p_Superior Licenciado    
{res}{txt}
{com}. 
. * save
. tempfile censo1981
{txt}
{com}. save `censo1981'
{txt}{p 0 4 2}
file {bf}
/var/folders/b_/14sh0g7d0294l0trnz839fn1d84l60/T//S_55310.000003{rm}
saved
as .dta format
{p_end}

{com}.         
.         
.         
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
. 
. *-------------------------------------------------------------------------------
. * 1990
. *-------------------------------------------------------------------------------
. 
. import excel "data/inputs/Census1990.xlsx", sheet("Proc1 T_Dist") clear 
{res}{text}(15 vars, 109 obs)

{com}. 
. * variable names
. drop in 1/10
{txt}(10 observations deleted)

{com}. compress
  {txt}variable {bf}{res}A{sf}{txt} was {bf}{res}str30{sf}{txt} now {bf}{res}str1{sf}
  {txt}variable {bf}{res}B{sf}{txt} was {bf}{res}str34{sf}{txt} now {bf}{res}str5{sf}
  {txt}variable {bf}{res}C{sf}{txt} was {bf}{res}str31{sf}{txt} now {bf}{res}str10{sf}
{txt}  (7,821 bytes saved)

{com}. foreach var of varlist C-I {c -(}
{txt}  2{com}.         local name = strtoname(`var'[1])
{txt}  3{com}.         rename `var' `name'
{txt}  4{com}.         {c )-}
{res}{txt}
{com}. drop in 1/1
{txt}(1 observation deleted)

{com}. rename B age
{res}{txt}
{com}. keep age-Total
{txt}
{com}. renvars *NINGUNO *PRE_ESCOLAR *PRIMARIA_BASICA *MEDIA_BASICA *SUPERIOR *DIVERSIFICADA, predrop(4)
{txt}
{com}. 
. * organize
. destring age-Total, replace force
{txt}age: contains nonnumeric characters; {res}replaced {txt}as {res}byte
{txt}(2 missing values generated)
{res}{txt}NINGUNO: all characters numeric; {res}replaced {txt}as {res}long
{txt}(1 missing value generated)
{res}{txt}PRE_ESCOLAR: contains nonnumeric characters; {res}replaced {txt}as {res}long
{txt}(90 missing values generated)
{res}{txt}PRIMARIA_BASICA: contains nonnumeric characters; {res}replaced {txt}as {res}long
{txt}(3 missing values generated)
{res}{txt}MEDIA_BASICA: contains nonnumeric characters; {res}replaced {txt}as {res}long
{txt}(10 missing values generated)
{res}{txt}DIVERSIFICADA: contains nonnumeric characters; {res}replaced {txt}as {res}long
{txt}(13 missing values generated)
{res}{txt}SUPERIOR: contains nonnumeric characters; {res}replaced {txt}as {res}long
{txt}(14 missing values generated)
{res}{txt}Total: all characters numeric; {res}replaced {txt}as {res}long
{txt}(1 missing value generated)
{res}{txt}
{com}. drop if age == . /* Total lines */
{txt}(2 observations deleted)

{com}. keep if age >= 18
{txt}(15 observations deleted)

{com}. 
. * proportions
. collapse (sum) NINGUNO-Total
{res}{txt}
{com}. foreach var of varlist NINGUNO-SUPERIOR {c -(}
{txt}  2{com}.         gen p_`var' = `var' / Total
{txt}  3{com}.         {c )-}
{txt}
{com}. keep p_*
{txt}
{com}. 
. * names
. gen year = 1990
{txt}
{com}. gen MenosDePrimaria = p_NINGUNO + p_PRE_ESCOLAR
{txt}
{com}. gen Primaria = p_PRIMARIA_BASICA + p_MEDIA_BASICA
{txt}
{com}. rename p_DIVERSIFICADA Bachiller
{res}{txt}
{com}. rename p_SUPERIOR Licenciado    
{res}{txt}
{com}. keep year Menos Prim Bach Lic 
{txt}
{com}. 
. * save
. tempfile censo1990
{txt}
{com}. save `censo1990'
{txt}{p 0 4 2}
file {bf}
/var/folders/b_/14sh0g7d0294l0trnz839fn1d84l60/T//S_55310.000004{rm}
saved
as .dta format
{p_end}

{com}.         
.         
.         
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
. 
. *-------------------------------------------------------------------------------
. * 2001
. *-------------------------------------------------------------------------------
. 
. import excel "data/inputs/Census2001.xlsx", sheet("Proc2 T_Dist") clear
{res}{text}(15 vars, 121 obs)

{com}. 
. * variable names
. drop in 1/10
{txt}(10 observations deleted)

{com}. compress
  {txt}variable {bf}{res}A{sf}{txt} was {bf}{res}str30{sf}{txt} now {bf}{res}str1{sf}
  {txt}variable {bf}{res}B{sf}{txt} was {bf}{res}str42{sf}{txt} now {bf}{res}str5{sf}
  {txt}variable {bf}{res}C{sf}{txt} was {bf}{res}str34{sf}{txt} now {bf}{res}str15{sf}
{txt}  (9,435 bytes saved)

{com}. foreach var of varlist C-L {c -(}
{txt}  2{com}.         local name = strtoname(`var'[1])
{txt}  3{com}.         rename `var' `name'
{txt}  4{com}.         {c )-}
{res}{txt}
{com}. drop in 1/1
{txt}(1 observation deleted)

{com}. rename B age
{res}{txt}
{com}. 
. * organize
. keep age-Total
{txt}
{com}. renvars *No_declarado *Ninguno *Preescolar *Básica___Primaria *Educación_Especial *Media *Técnico_Medio *Técnico_Superior *Universitario, predrop(4)
{txt}
{com}. destring age-Total, replace force
{txt}age: contains nonnumeric characters; {res}replaced {txt}as {res}int
{txt}(2 missing values generated)
{res}{txt}No_declarado: contains nonnumeric characters; {res}replaced {txt}as {res}long
{txt}(3 missing values generated)
{res}{txt}Ninguno: all characters numeric; {res}replaced {txt}as {res}long
{txt}(1 missing value generated)
{res}{txt}Preescolar: contains nonnumeric characters; {res}replaced {txt}as {res}long
{txt}(102 missing values generated)
{res}{txt}Básica___Primaria: contains nonnumeric characters; {res}replaced {txt}as {res}long
{txt}(3 missing values generated)
{res}{txt}Educación_Especial: contains nonnumeric characters; {res}replaced {txt}as {res}long
{txt}(11 missing values generated)
{res}{txt}Media: contains nonnumeric characters; {res}replaced {txt}as {res}long
{txt}(14 missing values generated)
{res}{txt}Técnico_Medio: contains nonnumeric characters; {res}replaced {txt}as {res}long
{txt}(19 missing values generated)
{res}{txt}Técnico_Superior: contains nonnumeric characters; {res}replaced {txt}as {res}long
{txt}(23 missing values generated)
{res}{txt}Universitario: contains nonnumeric characters; {res}replaced {txt}as {res}long
{txt}(18 missing values generated)
{res}{txt}Total: all characters numeric; {res}replaced {txt}as {res}long
{txt}(1 missing value generated)
{res}{txt}
{com}. drop if age == . /* Total lines */
{txt}(2 observations deleted)

{com}. keep if age >= 18
{txt}(15 observations deleted)

{com}. 
. * proportions
. collapse (sum) No_declarado-Total
{res}{txt}
{com}. foreach var of varlist No_declarado-Universit {c -(}
{txt}  2{com}.         gen p_`var' = `var' / Total
{txt}  3{com}.         {c )-}
{txt}
{com}. keep p_*
{txt}
{com}. gen MenosDePrimaria = p_Ninguno + p_Preescolar
{txt}
{com}. gen Primaria = p_Básica___Primaria
{txt}
{com}. gen Bachiller = p_Media + p_Técnico_Medio + p_Técnico_Superior
{txt}
{com}. rename p_Universitario Licenciado
{res}{txt}
{com}. 
. * save
. gen year = 2001 
{txt}
{com}. keep year Menos Prim Bach Lic 
{txt}
{com}. tempfile censo2001
{txt}
{com}. save `censo2001'
{txt}{p 0 4 2}
file {bf}
/var/folders/b_/14sh0g7d0294l0trnz839fn1d84l60/T//S_55310.000005{rm}
saved
as .dta format
{p_end}

{com}. 
. 
. 
.         
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
. 
. *-------------------------------------------------------------------------------
. * 2011
. *-------------------------------------------------------------------------------
. 
. import excel "data/inputs/Census2011.xlsx", sheet("Proc1 T_Dist") clear
{res}{text}(15 vars, 120 obs)

{com}. 
. * variable names
. drop in 1/10
{txt}(10 observations deleted)

{com}. compress
  {txt}variable {bf}{res}A{sf}{txt} was {bf}{res}str30{sf}{txt} now {bf}{res}str1{sf}
  {txt}variable {bf}{res}B{sf}{txt} was {bf}{res}str41{sf}{txt} now {bf}{res}str5{sf}
  {txt}variable {bf}{res}C{sf}{txt} was {bf}{res}str35{sf}{txt} now {bf}{res}str10{sf}
{txt}  (9,900 bytes saved)

{com}. foreach var of varlist C-J {c -(}
{txt}  2{com}.         local name = strtoname(`var'[1])
{txt}  3{com}.         rename `var' `name'
{txt}  4{com}.         {c )-}
{res}{txt}
{com}. drop in 1/1
{txt}(1 observation deleted)

{com}. rename B age
{res}{txt}
{com}. 
. * organize
. keep age-Total
{txt}
{com}. renvars age-Total, subst(__ )
{txt}
{com}. renvars _*, predrop(2)
{txt}
{com}. destring age-Total, replace force
{txt}age: contains nonnumeric characters; {res}replaced {txt}as {res}int
{txt}(2 missing values generated)
{res}{txt}No_sabe: all characters numeric; {res}replaced {txt}as {res}long
{txt}(1 missing value generated)
{res}{txt}Ninguno: all characters numeric; {res}replaced {txt}as {res}long
{txt}(1 missing value generated)
{res}{txt}InicialPreescolar_: contains nonnumeric characters; {res}replaced {txt}as {res}long
{txt}(102 missing values generated)
{res}{txt}Primaria1_6_: contains nonnumeric characters; {res}replaced {txt}as {res}long
{txt}(4 missing values generated)
{res}{txt}Secundaria1_5_6_: contains nonnumeric characters; {res}replaced {txt}as {res}long
{txt}(9 missing values generated)
{res}{txt}Técnico_Superior: contains nonnumeric characters; {res}replaced {txt}as {res}long
{txt}(20 missing values generated)
{res}{txt}Universitario: contains nonnumeric characters; {res}replaced {txt}as {res}long
{txt}(18 missing values generated)
{res}{txt}Total: all characters numeric; {res}replaced {txt}as {res}long
{txt}(1 missing value generated)
{res}{txt}
{com}. drop if age == . /* Total lines */
{txt}(2 observations deleted)

{com}. keep if age >= 18
{txt}(15 observations deleted)

{com}. 
. * proportions
. collapse (sum) No_sabe-Total
{res}{txt}
{com}. foreach var of varlist No_sabe-Universit {c -(}
{txt}  2{com}.         gen p_`var' = `var' / Total
{txt}  3{com}.         {c )-}
{txt}
{com}. gen MenosDePrimaria = p_Ninguno + p_InicialPreescolar_
{txt}
{com}. rename p_Primaria1_6_ Primaria
{res}{txt}
{com}. gen Bachiller = p_Secundaria1_5_6_ + p_Técnico_Superior
{txt}
{com}. rename p_Universitario Licenciado
{res}{txt}
{com}. 
. * save
. gen year = 2011
{txt}
{com}. keep year Menos Primaria Bach Lic 
{txt}
{com}. tempfile censo2011
{txt}
{com}. save `censo2011'
{txt}{p 0 4 2}
file {bf}
/var/folders/b_/14sh0g7d0294l0trnz839fn1d84l60/T//S_55310.000006{rm}
saved
as .dta format
{p_end}

{com}. 
. 
. 
.         
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.         
. *-------------------------------------------------------------------------------
. * append
. *-------------------------------------------------------------------------------
. 
. clear
{txt}
{com}. foreach year in 1961 1981 1990 2001 2011 {c -(}
{txt}  2{com}.         append using `censo`year''
{txt}  3{com}.         {c )-}
{txt}{p 0 7 2}
(variable
{bf:year} was {bf:int}, now {bf:float} to accommodate using data's values)
{p_end}

{com}. order year Menos 
{txt}
{com}. 
. 
. * End of subfile
. 
{txt}end of do-file

{com}. local n = _N
{txt}
{com}. set obs `=`n'+1'
{txt}{p}
Number of observations ({bf:_N}) was 5,
now 6.
{p_end}

{com}. replace year = 1971 if year == .
{txt}(1 real change made)

{com}. sort year
{txt}
{com}. gen mergeyear = year
{txt}
{com}. replace mergeyear = 1975 if year == 1971
{txt}(1 real change made)

{com}. tempfile censos 
{txt}
{com}. save `censos'
{txt}{p 0 4 2}
file {bf}
/var/folders/b_/14sh0g7d0294l0trnz839fn1d84l60/T//S_55310.000001{rm}
saved
as .dta format
{p_end}

{com}. 
. * Household surveys
. do "code_Stata/5b_TableB1_B.do"
{txt}
{com}. 
. 
. 
. 
.         
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.         
. 
. 
. *-------------------------------------------------------------------------------
. * 1970s–1990
. *-------------------------------------------------------------------------------
. 
. 
. foreach year in 1975 1981 1990 {c -(}
{txt}  2{com}. 
. 
. * Encuestas de hogares por muestreo (EHPM)
. use "data/inputs/EHPM_`year'_1.dta", clear
{txt}  3{com}. 
. 
. * Nivel alcanzado
. * For NGA codes, see NuevoManualV3.0.doc
. 
. gen nivel_alcanzado = "MenosDePrimaria" if nga == 0 | nga == 1 | (nga == 2 & ultgrado < 6)
{txt}  4{com}. 
. replace nivel_alcanzado = "Primaria" if (nga == 2 & ultgrado >= 6 & ultgrado ~= .) /// /* At least six years of primary */
>                                                                           | (nga >= 3 & nga <= 22 & ultgrado < 5) /* Or < 5 years of educación media */
{txt}  5{com}. 
. replace nivel_alcanzado = "Bachiller" if (nga >= 3 & nga <= 22 & ultgrado >= 5 & ultgrado ~= .) /// /* At least five years of high school */
>                                                                           |  (nga >= 23 & nga <= 69 & ultgrado < 5) /* Or < 5 years of university */
{txt}  6{com}. 
. replace nivel_alcanzado = "Licenciado" if (nga >= 23 & nga <= 69 & ultgrado >= 5 & ultgrado ~= .)       
{txt}  7{com}.                                                                   
. tab nivel_alcanzado if edad >= 18 [aw=peso]
{txt}  8{com}. 
. 
. * collapse
. keep if edad >= 18 & edad ~= .
{txt}  9{com}. gen count = 1
{txt} 10{com}. collapse (sum) count [fw=peso], by(nivel_alcanzado)
{txt} 11{com}. replace nivel = "Missing" if nivel == ""
{txt} 12{com}. 
. * proportions
. gen year = `year'
{txt} 13{com}. reshape wide count, i(year) j(nivel, string)
{txt} 14{com}. egen total = rowtotal(count*)
{txt} 15{com}. foreach var of varlist count* {c -(}
{txt} 16{com}.         gen p`var' = `var' / total
{txt} 17{com}.         {c )-}
{txt} 18{com}. keep year p*
{txt} 19{com}. renvars p*, predrop(6)
{txt} 20{com}. 
. 
. * save
. order year MenosDe Primaria Bach Lic
{txt} 21{com}. tempfile eh`year'
{txt} 22{com}. save `eh`year''
{txt} 23{com}. 
. {c )-}
{txt}(207,441 missing values generated)
(171,906 real changes made)
(20,908 real changes made)
(3,274 real changes made)

nivel_alcanzado {c |}      Freq.     Percent        Cum.
{hline 16}{c +}{hline 35}
      Bachiller {c |}{res} 25,611.802        8.22        8.22
{txt}     Licenciado {c |}{res} 5,080.1094        1.63        9.85
{txt}MenosDePrimaria {c |}{res} 154,577.08       49.61       59.46
{txt}       Primaria {c |}{res} 126,315.01       40.54      100.00
{txt}{hline 16}{c +}{hline 35}
          Total {c |}{res}    311,584      100.00
{txt}(367,418 observations deleted)
{res}{txt}(1 real change made)
(j = Bachiller Licenciado MenosDePrimaria Missing Primaria)

Data{col 36}Long{col 43}->{col 48}Wide
{hline 77}
Number of observations     {res}           5   {txt}->   {res}1           
{txt}Number of variables        {res}           3   {txt}->   {res}6           
{txt}j variable (5 values)   {res}nivel_alcanzado   {txt}->   (dropped)
xij variables:
                                  {res}count   {txt}->   {res}countBachiller countLicenciado ... countPrimaria
{txt}{hline 77}
{p 0 4 2}
file {bf}
/var/folders/b_/14sh0g7d0294l0trnz839fn1d84l60/T//S_55310.000002{rm}
saved
as .dta format
{p_end}
(296,795 missing values generated)
(233,360 real changes made)
(41,696 real changes made)
(6,797 real changes made)

nivel_alcanzado {c |}      Freq.     Percent        Cum.
{hline 16}{c +}{hline 35}
      Bachiller {c |}{res} 45,366.601       12.81       12.81
{txt}     Licenciado {c |}{res} 9,686.8118        2.73       15.54
{txt}MenosDePrimaria {c |}{res} 132,806.53       37.50       53.04
{txt}       Primaria {c |}{res} 166,320.06       46.96      100.00
{txt}{hline 16}{c +}{hline 35}
          Total {c |}{res}    354,180      100.00
{txt}(351,114 observations deleted)
{res}{txt}(1 real change made)
(j = Bachiller Licenciado MenosDePrimaria Missing Primaria)

Data{col 36}Long{col 43}->{col 48}Wide
{hline 77}
Number of observations     {res}           5   {txt}->   {res}1           
{txt}Number of variables        {res}           3   {txt}->   {res}6           
{txt}j variable (5 values)   {res}nivel_alcanzado   {txt}->   (dropped)
xij variables:
                                  {res}count   {txt}->   {res}countBachiller countLicenciado ... countPrimaria
{txt}{hline 77}
{p 0 4 2}
file {bf}
/var/folders/b_/14sh0g7d0294l0trnz839fn1d84l60/T//S_55310.000003{rm}
saved
as .dta format
{p_end}
(166,391 missing values generated)
(121,878 real changes made)
(34,119 real changes made)
(7,124 real changes made)

nivel_alcanzado {c |}      Freq.     Percent        Cum.
{hline 16}{c +}{hline 35}
      Bachiller {c |}{res} 32,950.828       19.53       19.53
{txt}     Licenciado {c |}{res} 8,246.7056        4.89       24.42
{txt}MenosDePrimaria {c |}{res} 44,800.464       26.56       50.98
{txt}       Primaria {c |}{res} 82,708.003       49.02      100.00
{txt}{hline 16}{c +}{hline 35}
          Total {c |}{res}    168,706      100.00
{txt}(155,329 observations deleted)
{res}{txt}(1 real change made)
(j = Bachiller Licenciado MenosDePrimaria Missing Primaria)

Data{col 36}Long{col 43}->{col 48}Wide
{hline 77}
Number of observations     {res}           5   {txt}->   {res}1           
{txt}Number of variables        {res}           3   {txt}->   {res}6           
{txt}j variable (5 values)   {res}nivel_alcanzado   {txt}->   (dropped)
xij variables:
                                  {res}count   {txt}->   {res}countBachiller countLicenciado ... countPrimaria
{txt}{hline 77}
{p 0 4 2}
file {bf}
/var/folders/b_/14sh0g7d0294l0trnz839fn1d84l60/T//S_55310.000004{rm}
saved
as .dta format
{p_end}

{com}. 
.         
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.         
. 
. 
. *-------------------------------------------------------------------------------
. * 2001
. *-------------------------------------------------------------------------------
. 
. use "data/inputs/EHPM_2001_2.dta", clear
{txt}
{com}. 
. * define categories
. gen nivel_alcanzado = "MenosDePrimaria" if eduniv == 1 | eduniv == 2
{txt}(166,695 missing values generated)

{com}. replace nivel_alcanzado = "Primaria" if eduniv == 3 | eduniv == 5 /* ASK FROD ABOUT THIS */
{txt}(114,856 real changes made)

{com}. replace nivel_alcanzado = "Bachiller" if eduniv == 4
{txt}(27,204 real changes made)

{com}. replace nivel_alcanzado = "Licenciado" if eduniv == 6
{txt}(11,902 real changes made)

{com}. replace nivel_alcanzado = "N/A" if eduniv < 0
{txt}(12,733 real changes made)

{com}. 
. * collapse
. keep if edad >= 18 & edad ~= .
{txt}(79,449 observations deleted)

{com}. gen count = 1
{txt}
{com}. collapse (sum) count [fw=peso], by(nivel_alcanzado)
{res}{txt}
{com}. replace nivel = "Missing" if nivel == "N/A"
{txt}(1 real change made)

{com}. 
. * proportions
. gen year = 2001
{txt}
{com}. reshape wide count, i(year) j(nivel, string)
{txt}(j = Bachiller Licenciado MenosDePrimaria Missing Primaria)

Data{col 36}Long{col 43}->{col 48}Wide
{hline 77}
Number of observations     {res}           5   {txt}->   {res}1           
{txt}Number of variables        {res}           3   {txt}->   {res}6           
{txt}j variable (5 values)   {res}nivel_alcanzado   {txt}->   (dropped)
xij variables:
                                  {res}count   {txt}->   {res}countBachiller countLicenciado ... countPrimaria
{txt}{hline 77}

{com}. egen total = rowtotal(count*)
{txt}
{com}. foreach var of varlist count* {c -(}
{txt}  2{com}.         gen p`var' = `var' / total
{txt}  3{com}.         {c )-}
{txt}
{com}. keep year p*
{txt}
{com}. renvars p*, predrop(6)
{txt}
{com}. 
. * save
. order year MenosDe Primaria Bach Lic
{txt}
{com}. tempfile eh2001
{txt}
{com}. save `eh2001'
{txt}{p 0 4 2}
file {bf}
/var/folders/b_/14sh0g7d0294l0trnz839fn1d84l60/T//S_55310.000005{rm}
saved
as .dta format
{p_end}

{com}. 
.         
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.         
. 
. 
. *-------------------------------------------------------------------------------
. * append all
. *-------------------------------------------------------------------------------
. 
. clear
{txt}
{com}. foreach year in 1975 1981 1990 2001 {c -(}
{txt}  2{com}.         append using `eh`year'' 
{txt}  3{com}. {c )-}
{txt}
{com}. 
. 
. * End of subfile
. 
{txt}end of do-file

{com}. gen mergeyear = year
{txt}
{com}. renvars year-Missing, postfix(_eh)
{txt}
{com}. 
. * Merge
. merge 1:1 mergeyear using `censos'
{res}
{txt}{col 5}Result{col 33}Number of obs
{col 5}{hline 41}
{col 5}Not matched{col 30}{res}               2
{txt}{col 9}from master{col 30}{res}               0{txt}  (_merge==1)
{col 9}from using{col 30}{res}               2{txt}  (_merge==2)

{col 5}Matched{col 30}{res}               4{txt}  (_merge==3)
{col 5}{hline 41}

{com}. drop _m
{txt}
{com}. 
. * organize
. sort year
{txt}
{com}. order year-Licenciado
{txt}
{com}. drop mergeyear
{txt}
{com}. 
. 
.         
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
. 
. *-------------------------------------------------------------------------------
. * format table 
. *-------------------------------------------------------------------------------
. 
. * rounding
. foreach var of varlist Menos* Prim* Bach* Lic* {c -(}
{txt}  2{com}.         replace `var' = round(`var'*100)
{txt}  3{com}.         {c )-}
{txt}(5 real changes made)
(4 real changes made)
(5 real changes made)
(4 real changes made)
(5 real changes made)
(4 real changes made)
(5 real changes made)
(4 real changes made)

{com}. tostring *, replace force
{txt}year was {res:float} now {res:str4}
MenosDePrimaria was {res:float} now {res:str2}
Primaria was {res:float} now {res:str2}
Bachiller was {res:float} now {res:str2}
Licenciado was {res:float} now {res:str2}
year_eh was {res:float} now {res:str4}
MenosDePrimaria_eh was {res:float} now {res:str2}
Primaria_eh was {res:float} now {res:str2}
Bachiller_eh was {res:float} now {res:str2}
Licenciado_eh was {res:float} now {res:str2}
Missing_eh was {res:float} now {res:str11}
Missing_eh was forced to string; some loss of information

{com}. 
. 
. * format
. foreach var of varlist Menos* Prim* Bach* Lic* {c -(}
{txt}  2{com}.         replace `var' = `var' + "\%" if `var' ~= "."
{txt}  3{com}.         replace `var' = "" if `var' == "."
{txt}  4{com}.         {c )-}
{txt}variable {bf}{res}MenosDePrimaria{sf}{txt} was {bf}{res}str2{sf}{txt} now {bf}{res}str4{sf}
{txt}(5 real changes made)
(1 real change made)
variable {bf}{res}MenosDePrimaria_eh{sf}{txt} was {bf}{res}str2{sf}{txt} now {bf}{res}str4{sf}
{txt}(4 real changes made)
(2 real changes made)
variable {bf}{res}Primaria{sf}{txt} was {bf}{res}str2{sf}{txt} now {bf}{res}str4{sf}
{txt}(5 real changes made)
(1 real change made)
variable {bf}{res}Primaria_eh{sf}{txt} was {bf}{res}str2{sf}{txt} now {bf}{res}str4{sf}
{txt}(4 real changes made)
(2 real changes made)
variable {bf}{res}Bachiller{sf}{txt} was {bf}{res}str2{sf}{txt} now {bf}{res}str4{sf}
{txt}(5 real changes made)
(1 real change made)
variable {bf}{res}Bachiller_eh{sf}{txt} was {bf}{res}str2{sf}{txt} now {bf}{res}str4{sf}
{txt}(4 real changes made)
(2 real changes made)
variable {bf}{res}Licenciado{sf}{txt} was {bf}{res}str2{sf}{txt} now {bf}{res}str4{sf}
{txt}(5 real changes made)
(1 real change made)
variable {bf}{res}Licenciado_eh{sf}{txt} was {bf}{res}str2{sf}{txt} now {bf}{res}str4{sf}
{txt}(4 real changes made)
(2 real changes made)

{com}. replace year_eh = "" if year_eh == "."  
{txt}(2 real changes made)

{com}.         
. 
. * turn 1961 gray
. foreach var of varlist year-Licenciado {c -(}
{txt}  2{com}.         replace `var' = "\textcolor{c -(}gray{c )-}{c -(}" + `var' + "{c )-}" if regexm(year, "1961")       
{txt}  3{com}.         {c )-}
{txt}variable {bf}{res}year{sf}{txt} was {bf}{res}str4{sf}{txt} now {bf}{res}str22{sf}
{txt}(1 real change made)
variable {bf}{res}MenosDePrimaria{sf}{txt} was {bf}{res}str4{sf}{txt} now {bf}{res}str22{sf}
{txt}(1 real change made)
variable {bf}{res}Primaria{sf}{txt} was {bf}{res}str4{sf}{txt} now {bf}{res}str22{sf}
{txt}(1 real change made)
variable {bf}{res}Bachiller{sf}{txt} was {bf}{res}str4{sf}{txt} now {bf}{res}str21{sf}
{txt}(1 real change made)
variable {bf}{res}Licenciado{sf}{txt} was {bf}{res}str4{sf}{txt} now {bf}{res}str21{sf}
{txt}(1 real change made)

{com}.         
. * Notes
. replace year = subinstr(year, "1961", "1961$^1$", .)
{txt}variable {bf}{res}year{sf}{txt} was {bf}{res}str22{sf}{txt} now {bf}{res}str26{sf}
{txt}(1 real change made)

{com}. replace year = "1971$^2$" if year == "1971"
{txt}(1 real change made)

{com}. 
. 
. * outsheet
. gen latex_table1 = year
{txt}
{com}. foreach var of varlist MenosDePrimaria-Licenciado_eh {c -(}
{txt}  2{com}.         replace latex_table1 = latex_table1 + " & " + `var'
{txt}  3{com}.         {c )-}
{txt}variable {bf}{res}latex_table1{sf}{txt} was {bf}{res}str26{sf}{txt} now {bf}{res}str51{sf}
{txt}(6 real changes made)
variable {bf}{res}latex_table1{sf}{txt} was {bf}{res}str51{sf}{txt} now {bf}{res}str76{sf}
{txt}(6 real changes made)
variable {bf}{res}latex_table1{sf}{txt} was {bf}{res}str76{sf}{txt} now {bf}{res}str100{sf}
{txt}(6 real changes made)
variable {bf}{res}latex_table1{sf}{txt} was {bf}{res}str100{sf}{txt} now {bf}{res}str124{sf}
{txt}(6 real changes made)
variable {bf}{res}latex_table1{sf}{txt} was {bf}{res}str124{sf}{txt} now {bf}{res}str127{sf}
{txt}(6 real changes made)
variable {bf}{res}latex_table1{sf}{txt} was {bf}{res}str127{sf}{txt} now {bf}{res}str130{sf}
{txt}(6 real changes made)
variable {bf}{res}latex_table1{sf}{txt} was {bf}{res}str130{sf}{txt} now {bf}{res}str133{sf}
{txt}(6 real changes made)
variable {bf}{res}latex_table1{sf}{txt} was {bf}{res}str133{sf}{txt} now {bf}{res}str136{sf}
{txt}(6 real changes made)
variable {bf}{res}latex_table1{sf}{txt} was {bf}{res}str136{sf}{txt} now {bf}{res}str139{sf}
{txt}(6 real changes made)

{com}. replace latex_table1 = latex_table1 + " \\[0.35em]"
{txt}variable {bf}{res}latex_table1{sf}{txt} was {bf}{res}str139{sf}{txt} now {bf}{res}str150{sf}
{txt}(6 real changes made)

{com}. outsheet latex_table1 using "tables/TableB1.tex", noquote nonames replace
{txt}{p 0 4 2}
(file {bf}
tables/TableB1.tex{rm}
not found)
{p_end}

{com}. 
. 
. * End
. 
{txt}end of do-file

{com}. do "code_Stata/6_TableB2.do"
{txt}
{com}.         
. 
.         ******************************************************************
.         **
.         **
.         **              DETAILS:        This file takes raw historical survey
.         **                                      data and creates a table of 
.         **                                      proportion of the population in each 
.         **                                      education category group.
.         **                              
.         **
.         ******************************************************************
. 
.                 
.                 
.                 
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.         
. *-------------------------------------------------------------------------------
. * 1973 Survey
. *-------------------------------------------------------------------------------
. 
. 
. * raw survey data
. use "data/inputs/Survey1973.dta", clear         
{txt}
{com}. 
. 
. * Education groups
. gen educ = "No primary" if educ_original == 0 | educ_original == 1
{txt}(903 missing values generated)

{com}. replace educ = "Primary complete" if educ_original == 2 | educ_original == 3
{txt}variable {bf}{res}educ{sf}{txt} was {bf}{res}str10{sf}{txt} now {bf}{res}str16{sf}
{txt}(629 real changes made)

{com}. replace educ = "Secondary complete" if educ_original >= 4 & educ_original <= 7
{txt}variable {bf}{res}educ{sf}{txt} was {bf}{res}str16{sf}{txt} now {bf}{res}str18{sf}
{txt}(260 real changes made)

{com}. replace educ = "Tertiary complete" if educ_original == 8        
{txt}(14 real changes made)

{com}. 
. * group indicators
. tab educ, gen(educ)     

              {txt}educ {c |}      Freq.     Percent        Cum.
{hline 19}{c +}{hline 35}
        No primary {c |}{res}        618       40.63       40.63
{txt}  Primary complete {c |}{res}        629       41.35       81.99
{txt}Secondary complete {c |}{res}        260       17.09       99.08
{txt} Tertiary complete {c |}{res}         14        0.92      100.00
{txt}{hline 19}{c +}{hline 35}
             Total {c |}{res}      1,521      100.00
{txt}
{com}. 
. * collapse
. collapse (sum) educ1-educ4
{res}{txt}
{com}. 
. * proportions
. egen total = rowtotal(educ1-educ4)
{txt}
{com}. gen MenosDePrimaria = educ1 / total
{txt}
{com}. gen Primaria = educ2 / total
{txt}
{com}. gen Bachiller = educ3 / total
{txt}
{com}. gen Licenciado = educ4 / total
{txt}
{com}. 
. * save
. keep Menos-Lic
{txt}
{com}. gen year = 1973
{txt}
{com}. tempfile opinion1973
{txt}
{com}. save `opinion1973'
{txt}{p 0 4 2}
file {bf}
/var/folders/b_/14sh0g7d0294l0trnz839fn1d84l60/T//S_55310.000001{rm}
saved
as .dta format
{p_end}

{com}.         
.         
.         
.         
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.         
. *-------------------------------------------------------------------------------
. * 1983 survey
. *-------------------------------------------------------------------------------
. 
. 
. * raw survey data
. use "data/inputs/Survey1983.dta", clear         
{txt}
{com}. 
. 
. * Education groups
. gen educ = "No primary" if educ_original == 1    | educ_original == 2
{txt}(1,437 missing values generated)

{com}. replace educ = "Primary complete" if educ_original == 3 | educ_original == 4
{txt}variable {bf}{res}educ{sf}{txt} was {bf}{res}str10{sf}{txt} now {bf}{res}str16{sf}
{txt}(877 real changes made)

{com}. replace educ = "Secondary complete" if educ_original == 5 | educ_original == 6
{txt}variable {bf}{res}educ{sf}{txt} was {bf}{res}str16{sf}{txt} now {bf}{res}str18{sf}
{txt}(438 real changes made)

{com}. replace educ = "Tertiary complete" if educ_original == 7
{txt}(114 real changes made)

{com}. drop if educ == ""
{txt}(8 observations deleted)

{com}. 
. * group indicators
. tab educ, gen(educ)      

              {txt}educ {c |}      Freq.     Percent        Cum.
{hline 19}{c +}{hline 35}
        No primary {c |}{res}        352       19.76       19.76
{txt}  Primary complete {c |}{res}        877       49.24       69.01
{txt}Secondary complete {c |}{res}        438       24.59       93.60
{txt} Tertiary complete {c |}{res}        114        6.40      100.00
{txt}{hline 19}{c +}{hline 35}
             Total {c |}{res}      1,781      100.00
{txt}
{com}. 
. * collapse
. collapse (sum) educ1-educ4
{res}{txt}
{com}. 
. * proportions
. egen total = rowtotal(educ1-educ4)
{txt}
{com}. gen MenosDePrimaria = educ1 / total
{txt}
{com}. gen Primaria = educ2 / total
{txt}
{com}. gen Bachiller = educ3 / total
{txt}
{com}. gen Licenciado = educ4 / total
{txt}
{com}. 
. * save
. keep Menos-Lic
{txt}
{com}. gen year = 1983
{txt}
{com}. tempfile opinion1983
{txt}
{com}. save `opinion1983'
{txt}{p 0 4 2}
file {bf}
/var/folders/b_/14sh0g7d0294l0trnz839fn1d84l60/T//S_55310.000002{rm}
saved
as .dta format
{p_end}

{com}.         
. 
.                 
.                 
.                 
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.         
. *-------------------------------------------------------------------------------
. * 1988
. *-------------------------------------------------------------------------------
.         
.         
. * raw survey data       
. use "data/inputs/Survey1988.dta", clear
{txt}
{com}. 
. 
. * Education groups
. gen educ = "No primary" if educ_original == 1    | educ_original == 2
{txt}(1,552 missing values generated)

{com}. replace educ = "Primary complete" if educ_original == 3 | educ_original == 4
{txt}variable {bf}{res}educ{sf}{txt} was {bf}{res}str10{sf}{txt} now {bf}{res}str16{sf}
{txt}(950 real changes made)

{com}. replace educ = "Secondary complete" if educ_original == 5 | educ_original == 6
{txt}variable {bf}{res}educ{sf}{txt} was {bf}{res}str16{sf}{txt} now {bf}{res}str18{sf}
{txt}(496 real changes made)

{com}. replace educ = "Tertiary complete" if educ_original == 7
{txt}(106 real changes made)

{com}. 
. * group indicators
. tab educ, gen(educ)     

              {txt}educ {c |}      Freq.     Percent        Cum.
{hline 19}{c +}{hline 35}
        No primary {c |}{res}        448       22.40       22.40
{txt}  Primary complete {c |}{res}        950       47.50       69.90
{txt}Secondary complete {c |}{res}        496       24.80       94.70
{txt} Tertiary complete {c |}{res}        106        5.30      100.00
{txt}{hline 19}{c +}{hline 35}
             Total {c |}{res}      2,000      100.00
{txt}
{com}.         
. * collapse
. collapse (sum) educ1-educ4
{res}{txt}
{com}. 
. * proportions
. egen total = rowtotal(educ1-educ4)
{txt}
{com}. gen MenosDePrimaria = educ1 / total
{txt}
{com}. gen Primaria = educ2 / total
{txt}
{com}. gen Bachiller = educ3 / total
{txt}
{com}. gen Licenciado = educ4 / total
{txt}
{com}. 
. * save
. keep Menos-Lic
{txt}
{com}. gen year = 1988
{txt}
{com}. tempfile opinion1988
{txt}
{com}. save `opinion1988'
{txt}{p 0 4 2}
file {bf}
/var/folders/b_/14sh0g7d0294l0trnz839fn1d84l60/T//S_55310.000003{rm}
saved
as .dta format
{p_end}

{com}. 
.                 
.                 
.                 
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.         
. *-------------------------------------------------------------------------------
. * 1993–2006
. *-------------------------------------------------------------------------------
.         
.         
. * Lupu replication data 
. use "data/inputs/Survey1993_2006_Lupu.dta", clear       
{txt}
{com}. 
. 
. * Education groups
. tab educ, gen(educ)

   {txt}Original {c |}
educ coding {c |}
    in Lupu {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
          0 {c |}{res}        924       13.43       13.43
{txt}          1 {c |}{res}      3,033       44.10       57.53
{txt}          2 {c |}{res}      1,934       28.12       85.65
{txt}          3 {c |}{res}        987       14.35      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}      6,878      100.00
{txt}
{com}. 
. * loop over weighted/unweighted 
. local i = 1
{txt}
{com}. foreach weight in "[aw=weight]" " " {c -(}
{txt}  2{com}. 
. * collapse
. preserve
{txt}  3{com}. collapse (sum) educ1-educ4 `weight', by(year)
{txt}  4{com}. 
. * proportions
. egen total = rowtotal(educ1-educ4)
{txt}  5{com}. gen MenosDePrimaria`i' = educ1 / total
{txt}  6{com}. gen Primaria`i' = educ2 / total
{txt}  7{com}. gen Bachiller`i' = educ3 / total
{txt}  8{com}. gen Licenciado`i' = educ4 / total
{txt}  9{com}. 
. * save
. keep year Menos-Lic
{txt} 10{com}. gen weight = "`weight'"
{txt} 11{com}. tempfile opinionLupu_`i'
{txt} 12{com}. save `opinionLupu_`i''
{txt} 13{com}. 
. * close loop
. local i = `i' + 1
{txt} 14{com}. restore
{txt} 15{com}. {c )-}
{res}{txt}{p 0 4 2}
file {bf}
/var/folders/b_/14sh0g7d0294l0trnz839fn1d84l60/T//S_55310.000005{rm}
saved
as .dta format
{p_end}
{res}{txt}{p 0 4 2}
file {bf}
/var/folders/b_/14sh0g7d0294l0trnz839fn1d84l60/T//S_55310.000007{rm}
saved
as .dta format
{p_end}

{com}. 
. * merge weighted + unweighted
. clear
{txt}
{com}. use `opinionLupu_1'
{txt}
{com}. merge 1:1 year using `opinionLupu_2'
{res}
{txt}{col 5}Result{col 33}Number of obs
{col 5}{hline 41}
{col 5}Not matched{col 30}{res}               0
{txt}{col 5}Matched{col 30}{res}               5{txt}  (_merge==3)
{col 5}{hline 41}

{com}. renvars *1, postfix(_wt)
{txt}
{com}. renvars *2, postdrop(1)
{txt}
{com}. drop weight _m
{txt}
{com}. 
. * save
. tempfile opinion1993
{txt}
{com}. save `opinion1993'
{txt}{p 0 4 2}
file {bf}
/var/folders/b_/14sh0g7d0294l0trnz839fn1d84l60/T//S_55310.000008{rm}
saved
as .dta format
{p_end}

{com}. 
.                 
.                 
.                 
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
. 
. *-------------------------------------------------------------------------------
. * 2012
. *-------------------------------------------------------------------------------
. 
. 
. * raw LAPOP data
. use "data/inputs/Survey2012_LAPOP.dta", clear
{txt}(All data are copyrighted by LAPOP. For more info, run the command note list)

{com}. 
. 
. * Education groups
. gen educ = "No primary" if educ_original < 6
{txt}(1,409 missing values generated)

{com}. replace educ = "Primary complete" if educ_original >= 6 & educ_original < 11
{txt}variable {bf}{res}educ{sf}{txt} was {bf}{res}str10{sf}{txt} now {bf}{res}str16{sf}
{txt}(532 real changes made)

{com}. replace educ = "Secondary complete" if educ_original >= 11 & educ_original < 15
{txt}variable {bf}{res}educ{sf}{txt} was {bf}{res}str16{sf}{txt} now {bf}{res}str18{sf}
{txt}(556 real changes made)

{com}. replace educ = "Tertiary complete" if educ_original >= 15 & educ_original ~= .
{txt}(321 real changes made)

{com}. 
. 
. * group indicators
. tab educ, gen(educ)

              {txt}educ {c |}      Freq.     Percent        Cum.
{hline 19}{c +}{hline 35}
        No primary {c |}{res}         91        6.07        6.07
{txt}  Primary complete {c |}{res}        532       35.47       41.53
{txt}Secondary complete {c |}{res}        556       37.07       78.60
{txt} Tertiary complete {c |}{res}        321       21.40      100.00
{txt}{hline 19}{c +}{hline 35}
             Total {c |}{res}      1,500      100.00
{txt}
{com}. 
. 
. * loop over weighted/unweighted
. local i = 1
{txt}
{com}. foreach weight in "[fw=wt]" " " {c -(}
{txt}  2{com}. 
. * collapse
. preserve
{txt}  3{com}. collapse (sum) educ1-educ4 `weight'
{txt}  4{com}. 
. * proportions
. egen total = rowtotal(educ1-educ4)
{txt}  5{com}. gen MenosDePrimaria`i' = educ1 / total
{txt}  6{com}. gen Primaria`i' = educ2 / total
{txt}  7{com}. gen Bachiller`i' = educ3 / total
{txt}  8{com}. gen Licenciado`i' = educ4 / total
{txt}  9{com}. 
. * save
. keep Menos-Lic
{txt} 10{com}. gen year = 2012
{txt} 11{com}. gen weight = "`weight'"
{txt} 12{com}. tempfile opinion2012_`i'
{txt} 13{com}. save `opinion2012_`i''
{txt} 14{com}. 
. * close loop
. local i = `i' + 1
{txt} 15{com}. restore
{txt} 16{com}. {c )-}
{res}{txt}{p 0 4 2}
file {bf}
/var/folders/b_/14sh0g7d0294l0trnz839fn1d84l60/T//S_55310.00000a{rm}
saved
as .dta format
{p_end}
{res}{txt}{p 0 4 2}
file {bf}
/var/folders/b_/14sh0g7d0294l0trnz839fn1d84l60/T//S_55310.00000c{rm}
saved
as .dta format
{p_end}

{com}. 
. * merge weighted/unweighted
. clear
{txt}
{com}. append using `opinion2012_1'
{txt}
{com}. merge 1:1 year using `opinion2012_2'
{res}
{txt}{col 5}Result{col 33}Number of obs
{col 5}{hline 41}
{col 5}Not matched{col 30}{res}               0
{txt}{col 5}Matched{col 30}{res}               1{txt}  (_merge==3)
{col 5}{hline 41}

{com}. renvars *1, postfix(_wt)
{txt}
{com}. renvars *2, postdrop(1)
{txt}
{com}. drop weight _m
{txt}
{com}. 
. * save
. tempfile opinion2012
{txt}
{com}. save `opinion2012'
{txt}{p 0 4 2}
file {bf}
/var/folders/b_/14sh0g7d0294l0trnz839fn1d84l60/T//S_55310.00000d{rm}
saved
as .dta format
{p_end}

{com}. 
.                 
.                 
.                 
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.         
. *-------------------------------------------------------------------------------
. * append all
. *-------------------------------------------------------------------------------
. 
. clear 
{txt}
{com}. foreach year in 1973 1983 1988 1993 2012 {c -(}
{txt}  2{com}.         append using `opinion`year''
{txt}  3{com}. {c )-}
{txt}
{com}. 
.                 
.                 
.                 
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
. 
. *-------------------------------------------------------------------------------
. * save table 
. *-------------------------------------------------------------------------------
. 
. 
. * organize
. order year
{txt}
{com}. foreach var of varlist Menos* Prim* Bach* Lic* {c -(}
{txt}  2{com}.         replace `var' = round(`var'*100)
{txt}  3{com}.         {c )-}
{txt}(9 real changes made)
(6 real changes made)
(9 real changes made)
(6 real changes made)
(9 real changes made)
(6 real changes made)
(9 real changes made)
(6 real changes made)

{com}. tostring *, replace force
{txt}year was {res:float} now {res:str4}
MenosDePrimaria was {res:float} now {res:str2}
Primaria was {res:float} now {res:str2}
Bachiller was {res:float} now {res:str2}
Licenciado was {res:float} now {res:str2}
MenosDePrimaria1_wt was {res:float} now {res:str2}
Primaria1_wt was {res:float} now {res:str2}
Bachiller1_wt was {res:float} now {res:str2}
Licenciado1_wt was {res:float} now {res:str2}

{com}. 
. 
. * format
. foreach var of varlist Menos* Prim* Bach* Lic* {c -(}
{txt}  2{com}.         replace `var' = `var' + "\%" if `var' ~= "."
{txt}  3{com}. {c )-}
{txt}variable {bf}{res}MenosDePrimaria{sf}{txt} was {bf}{res}str2{sf}{txt} now {bf}{res}str4{sf}
{txt}(9 real changes made)
variable {bf}{res}MenosDePrimaria1_wt{sf}{txt} was {bf}{res}str2{sf}{txt} now {bf}{res}str4{sf}
{txt}(6 real changes made)
variable {bf}{res}Primaria{sf}{txt} was {bf}{res}str2{sf}{txt} now {bf}{res}str4{sf}
{txt}(9 real changes made)
variable {bf}{res}Primaria1_wt{sf}{txt} was {bf}{res}str2{sf}{txt} now {bf}{res}str4{sf}
{txt}(6 real changes made)
variable {bf}{res}Bachiller{sf}{txt} was {bf}{res}str2{sf}{txt} now {bf}{res}str4{sf}
{txt}(9 real changes made)
variable {bf}{res}Bachiller1_wt{sf}{txt} was {bf}{res}str2{sf}{txt} now {bf}{res}str4{sf}
{txt}(6 real changes made)
variable {bf}{res}Licenciado{sf}{txt} was {bf}{res}str2{sf}{txt} now {bf}{res}str4{sf}
{txt}(9 real changes made)
variable {bf}{res}Licenciado1_wt{sf}{txt} was {bf}{res}str2{sf}{txt} now {bf}{res}str4{sf}
{txt}(6 real changes made)

{com}. 
.         
. * save
. gen latex_table1 = year
{txt}
{com}. foreach var of varlist MenosDePrimaria-Licenciado1_wt {c -(}
{txt}  2{com}.         replace latex_table1 = latex_table1 + " & " + `var'
{txt}  3{com}.         {c )-}
{txt}variable {bf}{res}latex_table1{sf}{txt} was {bf}{res}str4{sf}{txt} now {bf}{res}str11{sf}
{txt}(9 real changes made)
variable {bf}{res}latex_table1{sf}{txt} was {bf}{res}str11{sf}{txt} now {bf}{res}str18{sf}
{txt}(9 real changes made)
variable {bf}{res}latex_table1{sf}{txt} was {bf}{res}str18{sf}{txt} now {bf}{res}str25{sf}
{txt}(9 real changes made)
variable {bf}{res}latex_table1{sf}{txt} was {bf}{res}str25{sf}{txt} now {bf}{res}str32{sf}
{txt}(9 real changes made)
variable {bf}{res}latex_table1{sf}{txt} was {bf}{res}str32{sf}{txt} now {bf}{res}str39{sf}
{txt}(9 real changes made)
variable {bf}{res}latex_table1{sf}{txt} was {bf}{res}str39{sf}{txt} now {bf}{res}str46{sf}
{txt}(9 real changes made)
variable {bf}{res}latex_table1{sf}{txt} was {bf}{res}str46{sf}{txt} now {bf}{res}str53{sf}
{txt}(9 real changes made)
variable {bf}{res}latex_table1{sf}{txt} was {bf}{res}str53{sf}{txt} now {bf}{res}str60{sf}
{txt}(9 real changes made)

{com}. replace latex_table1 = latex_table1 + " \\"
{txt}variable {bf}{res}latex_table1{sf}{txt} was {bf}{res}str60{sf}{txt} now {bf}{res}str63{sf}
{txt}(9 real changes made)

{com}. outsheet latex_table1 using "tables/TableB2.tex", noquote nonames replace
{txt}{p 0 4 2}
(file {bf}
tables/TableB2.tex{rm}
not found)
{p_end}

{com}. 
. 
. * End
. 
{txt}end of do-file

{com}. do "code_Stata/7_TableB3.do"
{txt}
{com}. 
. * data from 0_PrepSurveyData.do
. use "data/outputs/EducAlternativesAppendix.dta", clear
{txt}
{com}. 
. 
. * labels
. replace version = "Reported in paper" if regexm(version, "Baseline")
{txt}variable {bf}{res}version{sf}{txt} was {bf}{res}str8{sf}{txt} now {bf}{res}str17{sf}
{txt}(1 real change made)

{com}. replace version = "College only for $<='73$" if regexm(version, "Tertiary")
{txt}variable {bf}{res}version{sf}{txt} was {bf}{res}str17{sf}{txt} now {bf}{res}str24{sf}
{txt}(1 real change made)

{com}. replace version = "W/ survey weights" if regexm(version, "Weighted")
{txt}(1 real change made)

{com}. 
. 
. * round
. foreach var of varlist estimate* {c -(}
{txt}  2{com}.         replace `var' = round(`var',0.1)
{txt}  3{com}.         {c )-}
{txt}(2 real changes made)
(2 real changes made)
(2 real changes made)
(2 real changes made)
(1 real change made)
(1 real change made)
(1 real change made)
(2 real changes made)
(2 real changes made)
(2 real changes made)
(2 real changes made)
(1 real change made)

{com}. tostring estimate*, replace force
{txt}estimate1958 was {res:double} now {res:str5}
estimate1963 was {res:double} now {res:str5}
estimate1963 was forced to string; some loss of information
estimate1968 was {res:double} now {res:str5}
estimate1973 was {res:double} now {res:str5}
estimate1973 was forced to string; some loss of information
estimate1978 was {res:double} now {res:str2}
estimate1983 was {res:double} now {res:str5}
estimate1983 was forced to string; some loss of information
estimate1988 was {res:double} now {res:str5}
estimate1988 was forced to string; some loss of information
estimate1993 was {res:double} now {res:str4}
estimate1993 was forced to string; some loss of information
estimate1998 was {res:double} now {res:str3}
estimate1998 was forced to string; some loss of information
estimate2000 was {res:double} now {res:str4}
estimate2006 was {res:double} now {res:str5}
estimate2006 was forced to string; some loss of information
estimate2012 was {res:double} now {res:str5}

{com}. 
. 
. * save
. gen latex_table1 = version
{txt}
{com}. foreach var of varlist estimate* {c -(}
{txt}  2{com}.         replace latex_table1 = latex_table1 + " & " + `var'
{txt}  3{com}.         {c )-}
{txt}variable {bf}{res}latex_table1{sf}{txt} was {bf}{res}str24{sf}{txt} now {bf}{res}str32{sf}
{txt}(3 real changes made)
variable {bf}{res}latex_table1{sf}{txt} was {bf}{res}str32{sf}{txt} now {bf}{res}str40{sf}
{txt}(3 real changes made)
variable {bf}{res}latex_table1{sf}{txt} was {bf}{res}str40{sf}{txt} now {bf}{res}str46{sf}
{txt}(3 real changes made)
variable {bf}{res}latex_table1{sf}{txt} was {bf}{res}str46{sf}{txt} now {bf}{res}str52{sf}
{txt}(3 real changes made)
variable {bf}{res}latex_table1{sf}{txt} was {bf}{res}str52{sf}{txt} now {bf}{res}str56{sf}
{txt}(3 real changes made)
variable {bf}{res}latex_table1{sf}{txt} was {bf}{res}str56{sf}{txt} now {bf}{res}str62{sf}
{txt}(3 real changes made)
variable {bf}{res}latex_table1{sf}{txt} was {bf}{res}str62{sf}{txt} now {bf}{res}str70{sf}
{txt}(3 real changes made)
variable {bf}{res}latex_table1{sf}{txt} was {bf}{res}str70{sf}{txt} now {bf}{res}str77{sf}
{txt}(3 real changes made)
variable {bf}{res}latex_table1{sf}{txt} was {bf}{res}str77{sf}{txt} now {bf}{res}str83{sf}
{txt}(3 real changes made)
variable {bf}{res}latex_table1{sf}{txt} was {bf}{res}str83{sf}{txt} now {bf}{res}str90{sf}
{txt}(3 real changes made)
variable {bf}{res}latex_table1{sf}{txt} was {bf}{res}str90{sf}{txt} now {bf}{res}str98{sf}
{txt}(3 real changes made)
variable {bf}{res}latex_table1{sf}{txt} was {bf}{res}str98{sf}{txt} now {bf}{res}str106{sf}
{txt}(3 real changes made)

{com}. replace latex = subinstr(latex, "& .", "& ", .)
{txt}(2 real changes made)

{com}. replace latex_table1 = latex_table1 + " \\"
{txt}variable {bf}{res}latex_table1{sf}{txt} was {bf}{res}str106{sf}{txt} now {bf}{res}str109{sf}
{txt}(3 real changes made)

{com}. outsheet latex_table1 using "tables/TableB3.tex", noquote nonames replace
{txt}{p 0 4 2}
(file {bf}
tables/TableB3.tex{rm}
not found)
{p_end}

{com}. 
. 
. * End
. 
{txt}end of do-file

{com}. 
. do "code_Stata/8_TableC1.do"
{txt}
{com}. 
. * AD and Chávez shares
. use "data/inputs/MunicipioData_AD_Chavez.dta", clear
{txt}
{com}. 
. 
. * merge 1968 CCN and MEP shares (congressional)
. merge 1:1 estado municipio using "data/inputs/MunicipioData_Congressional1968.dta"
{res}
{txt}{col 5}Result{col 33}Number of obs
{col 5}{hline 41}
{col 5}Not matched{col 30}{res}               3
{txt}{col 9}from master{col 30}{res}               3{txt}  (_merge==1)
{col 9}from using{col 30}{res}               0{txt}  (_merge==2)

{col 5}Matched{col 30}{res}             287{txt}  (_merge==3)
{col 5}{hline 41}

{com}. drop _m
{txt}
{com}. 
. 
. * merge 1993 Convergencia and LCR shares (presidential)
. merge 1:1 estado municipio using "data/inputs/MunicipioData_OtherParties1993.dta"
{res}
{txt}{col 5}Result{col 33}Number of obs
{col 5}{hline 41}
{col 5}Not matched{col 30}{res}               0
{txt}{col 5}Matched{col 30}{res}             290{txt}  (_merge==3)
{col 5}{hline 41}

{com}. drop _m
{txt}
{com}. 
. 
. * log CCN share
. gen ln_CCNshare = ln(.002 + CCNshare_Pequenas1968)
{txt}(3 missing values generated)

{com}. gen ln_MEPshare = ln(MEPshare)
{txt}(3 missing values generated)

{com}. 
. 
. * collect correlations
. mat outside = J(4, 1, 0)
{txt}
{com}. local i = 1
{txt}
{com}. foreach var of varlist ln_MEPshare ln_CCNshare share_presCONVERGENICA1993 share_presLCR1993 {c -(}
{txt}  2{com}. cor share_presOFIC1998 `var'
{txt}  3{com}.         mat outside[`i',1] = `r(rho)'
{txt}  4{com}.         local i = `i' + 1
{txt}  5{com}. {c )-}
{txt}(obs=287)

             {c |} sha~1998 ln_MEP~e
{hline 13}{c +}{hline 18}
share_p~1998 {c |}{res}   1.0000
 {txt}ln_MEPshare {c |}{res}   0.1495   1.0000

{txt}(obs=287)

             {c |} sha~1998 ln_CCN~e
{hline 13}{c +}{hline 18}
share_p~1998 {c |}{res}   1.0000
 {txt}ln_CCNshare {c |}{res}   0.2406   1.0000

{txt}(obs=283)

             {c |} sha~1998 sh~A1993
{hline 13}{c +}{hline 18}
share_p~1998 {c |}{res}   1.0000
{txt}share_~A1993 {c |}{res}   0.3286   1.0000

{txt}(obs=283)

             {c |} sha~1998 sh~R1993
{hline 13}{c +}{hline 18}
share_p~1998 {c |}{res}   1.0000
{txt}share_~R1993 {c |}{res}   0.4677   1.0000

{txt}
{com}. 
. 
. * table
. clear
{txt}
{com}. svmat outside
{txt}number of observations will be reset to 4
Press any key to continue, or Break to abort
{p}
Number of observations ({bf:_N}) was 0,
now 4.
{p_end}

{com}. 
. 
. * record parties
. gen party = ""
{txt}(4 missing values generated)

{com}. local i = 1
{txt}
{com}. foreach p in ln_MEPshare ln_CCNshare share_presCONVERGENICA1993 share_presLCR1993 {c -(}
{txt}  2{com}.         replace party = "`p'" if _n == `i'
{txt}  3{com}.         local i = `i' + 1
{txt}  4{com}. {c )-}
{txt}variable {bf}{res}party{sf}{txt} was {bf}{res}str1{sf}{txt} now {bf}{res}str11{sf}
{txt}(1 real change made)
(1 real change made)
variable {bf}{res}party{sf}{txt} was {bf}{res}str11{sf}{txt} now {bf}{res}str26{sf}
{txt}(1 real change made)
(1 real change made)

{com}. 
. 
. * party label
. gen partylabel = "MEP" if regexm(party, "MEP")
{txt}(3 missing values generated)

{com}. replace partylabel = "CCN" if regexm(party, "CCN")
{txt}(1 real change made)

{com}. replace partylabel = "Convergencia" if regexm(party, "CONVERG")
{txt}variable {bf}{res}partylabel{sf}{txt} was {bf}{res}str3{sf}{txt} now {bf}{res}str12{sf}
{txt}(1 real change made)

{com}. replace partylabel = "LCR" if regexm(party, "LCR")
{txt}(1 real change made)

{com}. 
. 
. * ideology
. gen ideology = "Left" if partylabel == "MEP"
{txt}(3 missing values generated)

{com}. replace ideology = "Far right" if partylabel == "CCN"
{txt}variable {bf}{res}ideology{sf}{txt} was {bf}{res}str4{sf}{txt} now {bf}{res}str9{sf}
{txt}(1 real change made)

{com}. replace ideology = "Center-left" if partylabel == "Convergencia"
{txt}variable {bf}{res}ideology{sf}{txt} was {bf}{res}str9{sf}{txt} now {bf}{res}str11{sf}
{txt}(1 real change made)

{com}. replace ideology = "Left" if partylabel == "LCR"
{txt}(1 real change made)

{com}. 
. 
. * year
. gen year = "1968, Congressional" if partylabel == "MEP" | partylabel == "CCN"
{txt}(2 missing values generated)

{com}. replace year = "1993, Presidential" if partylabel == "Convergencia" | partylabel == "LCR"
{txt}(2 real changes made)

{com}. 
. 
. * format correlation
. format outside1 %3.2f
{txt}
{com}. tostring outside1, replace usedisplayformat force
{txt}outside1 was {res:float} now {res:str4}
outside1 was forced to string; some loss of information

{com}. 
. 
. * tex 
. gen latex = partylabel 
{txt}
{com}. replace latex = latex + " & " + year + " & " + ideology + " & " + outside1
{txt}variable {bf}{res}latex{sf}{txt} was {bf}{res}str12{sf}{txt} now {bf}{res}str54{sf}
{txt}(4 real changes made)

{com}. replace latex = latex + " \\"   
{txt}variable {bf}{res}latex{sf}{txt} was {bf}{res}str54{sf}{txt} now {bf}{res}str57{sf}
{txt}(4 real changes made)

{com}. replace latex = latex + " \midrule" if _n == 2          
{txt}(1 real change made)

{com}. outsheet latex using "tables/TableC1.tex", noquote nonames replace
{txt}{p 0 4 2}
(file {bf}
tables/TableC1.tex{rm}
not found)
{p_end}

{com}. 
. 
. * End
. 
{txt}end of do-file

{com}. 
. do "code_Stata/9_FigureD1.do"
{txt}
{com}. 
. * data
. use "data/inputs/MunicipioData_AD_Chavez.dta", clear
{txt}
{com}. 
. * save correlation with density
. mat results = J(11, 2, 0)
{txt}
{com}. local i = 1
{txt}
{com}. foreach year of numlist 1963(5)1998 2000(6)2012 {c -(}
{txt}  2{com}.         cap cor ln_density`year' share_presAD`year'
{txt}  3{com}.         if _rc == 0 {c -(}
{txt}  4{com}.         mat results[`i',1] = `year'
{txt}  5{com}.         mat results[`i',2] = `r(rho)'
{txt}  6{com}.         {c )-}
{txt}  7{com}.         else {c -(}
{txt}  8{com}.         cor ln_density`year' share_presOFIC`year'
{txt}  9{com}.         mat results[`i',1] = `year'
{txt} 10{com}.         mat results[`i',2] = `r(rho)'
{txt} 11{com}.         {c )-}
{txt} 12{com}.         local i = `i' + 1
{txt} 13{com}. {c )-}
{txt}(obs=287)

             {c |} ln_~1998 sha~1998
{hline 13}{c +}{hline 18}
ln_dens~1998 {c |}{res}   1.0000
{txt}share_p~1998 {c |}{res}   0.2676   1.0000

{txt}(obs=287)

             {c |} ln_~2000 sha~2000
{hline 13}{c +}{hline 18}
ln_dens~2000 {c |}{res}   1.0000
{txt}share_p~2000 {c |}{res}  -0.0029   1.0000

{txt}(obs=287)

             {c |} ln_~2006 sha~2006
{hline 13}{c +}{hline 18}
ln_dens~2006 {c |}{res}   1.0000
{txt}share_p~2006 {c |}{res}  -0.3555   1.0000

{txt}(obs=287)

             {c |} ln_~2012 sha~2012
{hline 13}{c +}{hline 18}
ln_dens~2012 {c |}{res}   1.0000
{txt}share_p~2012 {c |}{res}  -0.3757   1.0000

{txt}
{com}. 
. * use results
. clear 
{txt}
{com}. svmat results
{txt}number of observations will be reset to 11
Press any key to continue, or Break to abort
{p}
Number of observations ({bf:_N}) was 0,
now 11.
{p_end}

{com}. rename results1 year
{res}{txt}
{com}. rename results2 cor_density
{res}{txt}
{com}. 
. 
. 
. * density graph for paper
. #delimit;
{txt}delimiter now ;
{com}. twoway (connected cor_density year if year >= 1958, 
>             lcolor(white) mcolor(white) 
>             mlwidth(thick) mlcolor(white) msize(large))
>                 
>            (connected cor_density year if year >= 1958 & year <= 2012, 
>             lcolor(black) mcolor(black) lwidth(medthick)
>             mlwidth(thick) mlcolor(white) msize(large))
>                 
>            (scatter cor_density year if year == 1958, 
>             mcolor(black) 
>             mlwidth(thick) mlcolor(white) msize(large))
>                 
>            (scatter cor_density year if year >= 1998 & year <= 2012, 
>             lcolor(black) mcolor(black) lwidth(medthick) msymbol(diamond)
>             mlwidth(thick) mlcolor(white) msize(large))
>                 
>            (scatter cor_density year if year == 1998, 
>             lcolor(black) mcolor(blue) msymbol(diamond)
>             mlwidth(thick) mlcolor(white) msize(large)),
> 
>                 yline(0, lwidth(thick) lcolor(gs12))
>                 graphregion(fcolor(white) lcolor(white) margin(zero))
>         plotregion(fcolor(white) lstyle(none) lcolor(white) ilstyle(none))
>         xsize(11) ysize(7.75)
>                 title("", size(large))
>                 ytitle("Correlation with Population Density", color(black) size(large))
>                 xtitle("")
>         yscale()
>                 ylabel(-.6(.2).4, labsize(large) glcolor(white))
>                 xlabel(1958 "1958"
>                 1968 "1968"
>                 1978 "1978"
>                 1988 "1988"
>                 1998 "98  "
>                 2000 "  00"
>                 2006 "2006"
>                 2012 "2012", labsize(large))
>                 xscale( range(1958 2014))
>         legend(order(3 "AD vs. Density" 4 "Chávez vs. Density") pos(8) ring(0) rows(2) region(lcolor(white)));
{res}{txt}
{com}. graph export "figures/FigureD1.pdf", replace;
{txt}{p 0 4 2}
file {bf}
/Users/kronick/Riker/Replication/figures/FigureD1.pdf{rm}
saved as
PDF
format
{p_end}

{com}. * End

{txt}end of do-file

{com}. do "code_Stata/10_FigureD2.do"
{txt}
{com}. 
. 
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.         
. *-------------------------------------------------------------------------------
. * base year 2012 
. *-------------------------------------------------------------------------------
. 
. * data
. use "data/inputs/MunicipioData_AD_Chavez.dta", clear
{txt}
{com}. 
. * save correlation with Chávez 2012
. mat results = J(11, 2, 0)
{txt}
{com}. local i = 1
{txt}
{com}. foreach year of numlist 1958(5)1998 2000(6)2006 {c -(}
{txt}  2{com}.         cap cor share_presOFIC2012 share_presAD`year'
{txt}  3{com}.         if _rc == 0 {c -(}
{txt}  4{com}.         mat results[`i',1] = `year'
{txt}  5{com}.         mat results[`i',2] = `r(rho)'
{txt}  6{com}.         {c )-}
{txt}  7{com}.         else {c -(}
{txt}  8{com}.         cor share_presOFIC2012 share_presOFIC`year'
{txt}  9{com}.         mat results[`i',1] = `year'
{txt} 10{com}.         mat results[`i',2] = `r(rho)'
{txt} 11{com}.         {c )-}
{txt} 12{com}.         local i = `i' + 1
{txt} 13{com}. {c )-}
{txt}(obs=287)

             {c |} sha~2012 sha~1998
{hline 13}{c +}{hline 18}
share_p~2012 {c |}{res}   1.0000
{txt}share_p~1998 {c |}{res}   0.2488   1.0000

{txt}(obs=287)

             {c |} sha~2012 sha~2000
{hline 13}{c +}{hline 18}
share_p~2012 {c |}{res}   1.0000
{txt}share_p~2000 {c |}{res}   0.5056   1.0000

{txt}(obs=287)

             {c |} sha~2012 sha~2006
{hline 13}{c +}{hline 18}
share_p~2012 {c |}{res}   1.0000
{txt}share_p~2006 {c |}{res}   0.7954   1.0000

{txt}
{com}. 
. * use results
. clear 
{txt}
{com}. svmat results
{txt}number of observations will be reset to 11
Press any key to continue, or Break to abort
{p}
Number of observations ({bf:_N}) was 0,
now 11.
{p_end}

{com}. rename results1 year
{res}{txt}
{com}. rename results2 cor2012
{res}{txt}
{com}. 
. * line
. su cor2012 if year == 1998

{txt}    Variable {c |}        Obs        Mean    Std. dev.       Min        Max
{hline 13}{c +}{hline 57}
{space 5}cor2012 {c |}{res}          1    .2488435           .   .2488435   .2488435
{txt}
{com}. local xline = `r(mean)'
{txt}
{com}. 
. * graph
. #delimit;
{txt}delimiter now ;
{com}. twoway (connected cor2012 year if year >= 1958 & year <= 2012, 
>             lcolor(black) mcolor(black) lwidth(medthick)
>             mlwidth(thick) mlcolor(white) msize(large))
>                 
>            (scatter cor2012 year if year == 1963, 
>             mcolor(black) 
>             mlwidth(thick) mlcolor(white) msize(large))
>                 
>            (scatter cor2012 year if year >= 1998 & year <= 2012, 
>             lcolor(black) mcolor(black) lwidth(medthick) msymbol(diamond)
>             mlwidth(thick) mlcolor(white) msize(large))
>                 
>            (scatter cor2012 year if year == 1998, 
>             lcolor(black) mcolor(blue) msymbol(diamond)
>             mlwidth(thick) mlcolor(white) msize(large)),
> 
>                 yline(0, lwidth(thick) lcolor(gs12))
>                 yline(`xline', lwidth(thin) lcolor(blue))
>                 graphregion(fcolor(white) lcolor(white) margin(zero))
>         plotregion(fcolor(white) lstyle(none) lcolor(white) ilstyle(none))
>         xsize(11) ysize(7.75)
>                 title("", size(large))
>                 ytitle("Correlation with 2012 Chávez vote share", color(black) size(large))                    
>                 xtitle("")
>         yscale()
>                 ylabel(-.2(.2)1, labsize(large) glcolor(white) angle(horizontal))
>                 xlabel(1958 "1958"
>                 1968 "1968"
>                 1978 "1978"
>                 1988 "1988"
>                 1998 "98  "
>                 2000 "  00"
>                 2006 "2006"
>                 2012 "2012", labsize(large))
>                 xscale( range(1958 2014))
>         legend(order(2 "AD vs. Chávez 2012" 3 "Chávez vs. Chávez 2012") pos(8) ring(0) rows(2) region(lcolor(white)));
{res}{txt}
{com}.                 graph export "figures/FigureD2a.pdf", replace;
{txt}{p 0 4 2}
file {bf}
/Users/kronick/Riker/Replication/figures/FigureD2a.pdf{rm}
saved as
PDF
format
{p_end}

{com}. #delimit cr
{txt}delimiter now cr
{com}. 
. 
. 
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.         
. *-------------------------------------------------------------------------------
. * base year 1998 
. *-------------------------------------------------------------------------------
. 
. * data
. use "data/inputs/MunicipioData_AD_Chavez.dta", clear
{txt}
{com}. 
. * save correlation with Chávez 1998
. mat results = J(11, 2, 0)
{txt}
{com}. local i = 1
{txt}
{com}. foreach year of numlist 1958(5)1993 2000(6)2012 {c -(}
{txt}  2{com}.         cap cor share_presOFIC1998 share_presAD`year'
{txt}  3{com}.         if _rc == 0 {c -(}
{txt}  4{com}.         mat results[`i',1] = `year'
{txt}  5{com}.         mat results[`i',2] = `r(rho)'
{txt}  6{com}.         {c )-}
{txt}  7{com}.         else {c -(}
{txt}  8{com}.         cor share_presOFIC1998 share_presOFIC`year'
{txt}  9{com}.         mat results[`i',1] = `year'
{txt} 10{com}.         mat results[`i',2] = `r(rho)'
{txt} 11{com}.         {c )-}
{txt} 12{com}.         local i = `i' + 1
{txt} 13{com}. {c )-}
{txt}(obs=287)

             {c |} sha~1998 sha~2000
{hline 13}{c +}{hline 18}
share_p~1998 {c |}{res}   1.0000
{txt}share_p~2000 {c |}{res}   0.6673   1.0000

{txt}(obs=287)

             {c |} sha~1998 sha~2006
{hline 13}{c +}{hline 18}
share_p~1998 {c |}{res}   1.0000
{txt}share_p~2006 {c |}{res}   0.4384   1.0000

{txt}(obs=287)

             {c |} sha~1998 sha~2012
{hline 13}{c +}{hline 18}
share_p~1998 {c |}{res}   1.0000
{txt}share_p~2012 {c |}{res}   0.2488   1.0000

{txt}
{com}. 
. * use results
. clear 
{txt}
{com}. svmat results
{txt}number of observations will be reset to 11
Press any key to continue, or Break to abort
{p}
Number of observations ({bf:_N}) was 0,
now 11.
{p_end}

{com}. rename results1 year
{res}{txt}
{com}. rename results2 cor1998
{res}{txt}
{com}. 
. * graph
. #delimit;
{txt}delimiter now ;
{com}. twoway (connected cor1998 year if year >= 1958 & year <= 1993, 
>             lcolor(black) mcolor(black) lwidth(medthick)
>             mlwidth(thick) mlcolor(white) msize(large))
>                 
>            (connected cor1998 year if year >= 2000 & year <= 2012, 
>             lcolor(black) mcolor(black) lwidth(medthick) msymbol(diamond)
>             mlwidth(thick) mlcolor(white) msize(large)),
> 
>                 yline(0, lwidth(thick) lcolor(gs12))            
>                 graphregion(fcolor(white) lcolor(white) margin(zero))
>         plotregion(fcolor(white) lstyle(none) lcolor(white) ilstyle(none))
>         xsize(11) ysize(7.75)           
>                 title("", size(large))          
>                 ytitle("Correlation with 1998 Chávez vote share", color(black) size(large))                            
>                 xtitle("")
>         yscale()
>                 ylabel(-.2(.2)1, labsize(large) glcolor(white) angle(horizontal))
>                 xlabel(1958 "1958"
>                 1968 "1968"
>                 1978 "1978"
>                 1988 "1988"
>                 1998 "98  "
>                 2000 "  00"
>                 2006 "2006"
>                 2012 "2012", labsize(large))
>                 xscale( range(1958 2014))
>         legend(order(3 "AD vs. Chávez 1998" 4 "Chávez vs. Chávez 1998") pos(8) ring(0) rows(2) region(lcolor(white)));
{res}{txt}
{com}.         graph export "figures/FigureD2b.pdf", replace;
{txt}{p 0 4 2}
file {bf}
/Users/kronick/Riker/Replication/figures/FigureD2b.pdf{rm}
saved as
PDF
format
{p_end}

{com}. #delimit cr
{txt}delimiter now cr
{com}. 
. 
. * End
. 
{txt}end of do-file

{com}. do "code_Stata/11_FigureD3.do"
{txt}
{com}. 
. * data  
. use "data/inputs/PrecinctData.dta", clear
{txt}
{com}. 
. 
. * normalize
. egen mesascount = count(chavista), by(year)
{txt}
{com}. sort year nonmiss_twoprevyears
{txt}
{com}. by year: gen n = _n 
{txt}
{com}. gen pctile = n / mesascount
{txt}
{com}. 
. 
. * density graph for appendix
. #delimit;
{txt}delimiter now ;
{com}. twoway  (kdensity nonmiss_twoprevyears  if year == 1998 & pctile >= 0.001 & pctile <= 0.999, 
>                  lcolor(blue))
>                 (kdensity nonmiss_twoprevyears  if year == 2000 & pctile >= 0.001 & pctile <= 0.999, 
>                  lcolor(blue%50) lpattern(dash))
>                 (kdensity nonmiss_twoprevyears  if year == 2006 & pctile >= 0.001 & pctile <= 0.999, 
>                  lcolor(black%50))
>             (kdensity nonmiss_twoprevyears  if year == 2012 & pctile >= 0.001 & pctile <= 0.999, 
>                  lcolor(black) lpattern(dash) lwidth(vthin)),
>                 graphregion(fcolor(white) lcolor(white) margin(zero))
>         plotregion(fcolor(white) lstyle(none) lcolor(white) ilstyle(none))
>         xsize(11) ysize(5)
>                 title("", size(large))
>                 ytitle("Density", color(black) size(large))
>                 xtitle("Proportion of Voters with Formal Employment", size(large))
>         yscale()
>                 ylabel(, labsize(large) glcolor(white) angle(horizontal))
>                 xlabel(, labsize(large))
>                 legend(order(1 "1998" 2 "2000" 3 "2006" 4 "2012")        cols(1) pos(2) ring(0)
>                 region(lcolor(white)));
{res}{txt}
{com}. graph export "figures/FigureD3a.pdf", replace;
{txt}{p 0 4 2}
file {bf}
/Users/kronick/Riker/Replication/figures/FigureD3a.pdf{rm}
saved as
PDF
format
{p_end}

{com}. #delimit cr
{txt}delimiter now cr
{com}. 
. 
. * gradient graph for appendix
. #delimit;
{txt}delimiter now ;
{com}. twoway  (lpolyci chavista nonmiss_twoprevyears if year == 1998 & pctile >= 0.001 & pctile <= 0.999, 
>              lcolor(blue%50) lwidth(vthin) ciplot(rline) degree(1))
>                  
>                 (lpoly chavista nonmiss_twoprevyears if year == 1998 & pctile >= 0.001 & pctile <= 0.999,
>                 lcolor(blue) degree(1))
>                                 
>                 (lpolyci chavista nonmiss_twoprevyears if year == 2000 & pctile >= 0.001 & pctile <= 0.999, 
>              lcolor(blue%30) lwidth(vthin) ciplot(rline) degree(1))
>                 
>                 (lpoly chavista nonmiss_twoprevyears if year == 2000 & pctile >= 0.001 & pctile <= 0.999, 
>                 lcolor(blue%70) lpattern(dash)  degree(1))
>                 
>                 (lpolyci chavista nonmiss_twoprevyears if year == 2006 & pctile >= 0.001 & pctile <= 0.999, 
>              lcolor(black%30) lwidth(vthin) ciplot(rline) degree(1))
>                 
>                 (lpoly chavista nonmiss_twoprevyears if year == 2006 & pctile >= 0.001 & pctile <= 0.999, 
>                 lcolor(black%50) degree(1))
>             
>                 (lpolyci chavista nonmiss_twoprevyears if year == 2012 & pctile >= 0.001 & pctile <= 0.999, 
>              lcolor(black%50) lwidth(vthin) ciplot(rline) degree(1))
>                 
>                 (lpoly chavista nonmiss_twoprevyears if year == 2012 & pctile >= 0.001 & pctile <= 0.999, 
>                 lcolor(black) lpattern(dash)  degree(1)),
> 
>                 graphregion(fcolor(white) lcolor(white) margin(zero))
>         plotregion(fcolor(white) lstyle(none) lcolor(white) ilstyle(none))
>         xsize(11) ysize(5)
>                 title("", size(large))
>                 ytitle("Chávez Vote Share", color(black) size(large))
>                 xtitle("Fraction of Voters with Formal Employment", size(large))
>         yscale()
>                 xscale()
>                 ylabel(.3(.1).9, labsize(large) glcolor(white) angle(horizontal))
>                 xlabel(, labsize(large))
>                 legend(order(3 "1998" 6 "2000" 9 "2006" 12 "2012")       cols(1) pos(2) ring(0)
>                 region(lcolor(white)));
{res}{txt}
{com}. graph export "figures/FigureD3b.pdf", replace;
{txt}{p 0 4 2}
file {bf}
/Users/kronick/Riker/Replication/figures/FigureD3b.pdf{rm}
saved as
PDF
format
{p_end}

{com}. * End

{txt}end of do-file

{com}. 
. do "code_Stata/12_FigureE4.do"
{txt}
{com}. 
. 
. 
. 
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.         
. *-------------------------------------------------------------------------------
. * E4a
. *-------------------------------------------------------------------------------
. 
. * data
. use "data/inputs/MunicipioData_AD_Chavez.dta", clear
{txt}
{com}. 
. * save correlation with AD 1958
. mat results = J(11, 2, 0)
{txt}
{com}. local i = 1
{txt}
{com}. foreach year of numlist 1963(5)1998 2000(6)2012 {c -(}
{txt}  2{com}.         cap cor share_presAD1958 share_presAD`year'
{txt}  3{com}.         if _rc == 0 {c -(}
{txt}  4{com}.         mat results[`i',1] = `year'
{txt}  5{com}.         mat results[`i',2] = `r(rho)'
{txt}  6{com}.         {c )-}
{txt}  7{com}.         else {c -(}
{txt}  8{com}.         cor share_presAD1958 share_presOFIC`year'
{txt}  9{com}.         mat results[`i',1] = `year'
{txt} 10{com}.         mat results[`i',2] = `r(rho)'
{txt} 11{com}.         {c )-}
{txt} 12{com}.         local i = `i' + 1
{txt} 13{com}. {c )-}
{txt}(obs=287)

             {c |} sha~1958 sha~1998
{hline 13}{c +}{hline 18}
share_p~1958 {c |}{res}   1.0000
{txt}share_p~1998 {c |}{res}  -0.0174   1.0000

{txt}(obs=287)

             {c |} sha~1958 sha~2000
{hline 13}{c +}{hline 18}
share_p~1958 {c |}{res}   1.0000
{txt}share_p~2000 {c |}{res}   0.0761   1.0000

{txt}(obs=287)

             {c |} sha~1958 sha~2006
{hline 13}{c +}{hline 18}
share_p~1958 {c |}{res}   1.0000
{txt}share_p~2006 {c |}{res}   0.3571   1.0000

{txt}(obs=287)

             {c |} sha~1958 sha~2012
{hline 13}{c +}{hline 18}
share_p~1958 {c |}{res}   1.0000
{txt}share_p~2012 {c |}{res}   0.4364   1.0000

{txt}
{com}. 
. * use results
. clear 
{txt}
{com}. svmat results
{txt}number of observations will be reset to 11
Press any key to continue, or Break to abort
{p}
Number of observations ({bf:_N}) was 0,
now 11.
{p_end}

{com}. rename results1 year
{res}{txt}
{com}. rename results2 cor1958
{res}{txt}
{com}. 
. * Figure E4A
. #delimit;
{txt}delimiter now ;
{com}. twoway (connected cor1958 year if year > 1958, 
>             lcolor(white) mcolor(white) 
>             mlwidth(thick) mlcolor(white) msize(large))
>                 
>            (connected cor1958 year if year >= 1963 & year <= 2012, 
>             lcolor(black) mcolor(black) lwidth(medthick)
>             mlwidth(thick) mlcolor(white) msize(large))
>                 
>            (scatter cor1958 year if year == 1963, 
>             mcolor(black) 
>             mlwidth(thick) mlcolor(white) msize(large))
>                 
>            (scatter cor1958 year if year >= 1998 & year <= 2012, 
>             lcolor(black) mcolor(black) lwidth(medthick) msymbol(diamond)
>             mlwidth(thick) mlcolor(white) msize(large))
>                 
>            (scatter cor1958 year if year == 1998, 
>             lcolor(black) mcolor(blue) msymbol(diamond)
>             mlwidth(thick) mlcolor(white) msize(large)),
> 
>                 yline(0, lwidth(thick) lcolor(gs12))
>                 graphregion(fcolor(white) lcolor(white) margin(zero))
>         plotregion(fcolor(white) lstyle(none) lcolor(white) ilstyle(none))
>                 xsize(7) ysize(5)       
>                 title("", size(large))
>                 ytitle("Correlation with 1958 AD vote share", color(black) size(large))
>                 xtitle("")
>                 yscale()
>                 ylabel(-.2(.2)1, labsize(large) glcolor(white) angle(horizontal))
>                 xlabel(1958 "1958"
>                 1968 "1968"
>                 1978 "1978"
>                 1988 "1988"
>                 1998 "98  "
>                 2000 "  00"
>                 2006 "2006"
>                 2012 "2012", labsize(large))
>                 xscale( range(1958 2014))
>         legend(order(3 "AD vs. AD 1958" 4 "Chávez vs. AD 1958") pos(8) ring(0) rows(2)                   region(lcolor(white)));
{res}{txt}
{com}. graph export "figures/FigureE4a.pdf", replace;
{txt}{p 0 4 2}
file {bf}
/Users/kronick/Riker/Replication/figures/FigureE4a.pdf{rm}
saved as
PDF
format
{p_end}

{com}. #delimit cr
{txt}delimiter now cr
{com}. 
.         
. 
. 
. 
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.         
. *-------------------------------------------------------------------------------
. * E4b
. *-------------------------------------------------------------------------------
. 
. 
. * data
. use "data/inputs/MunicipioData_AD_Chavez.dta", clear
{txt}
{com}. 
. 
. * collapse to state level
. * Note: this is approximate
. drop ln_density*
{txt}
{com}. reshape long share_presAD share_presOFIC pob_cgr, i(estado municipio) j(year)
{txt}(j = 1958 1963 1968 1973 1978 1983 1988 1993 1998 2000 2006 2012)
(variable {bf:share_presOFIC1958} not found)
(variable {bf:share_presOFIC1963} not found)
(variable {bf:share_presOFIC1968} not found)
(variable {bf:share_presOFIC1973} not found)
(variable {bf:share_presOFIC1978} not found)
(variable {bf:share_presOFIC1983} not found)
(variable {bf:share_presOFIC1988} not found)
share_presAD1993:  {res}282{txt} values would be changed; not changed
(variable {bf:share_presOFIC1993} not found)
(variable {bf:share_presAD1998} not found)
(variable {bf:share_presAD2000} not found)
(variable {bf:share_presAD2006} not found)
(variable {bf:share_presAD2012} not found)

Data{col 36}Wide{col 43}->{col 48}Long
{hline 77}
Number of observations     {res}         290   {txt}->   {res}3,480       
{txt}Number of variables        {res}          26   {txt}->   {res}6           
{txt}j variable (12 values)                    ->   {res}year
{txt}xij variables:
{res}share_presAD1958 share_presAD1963 ... share_presAD2012{txt}->{res}share_presAD
share_presOFIC1958 share_presOFIC1963 ... share_presOFIC2012{txt}->{res}share_presOFIC
pob_cgr1958 pob_cgr1963 ... pob_cgr2012   {txt}->   {res}pob_cgr
{txt}{hline 77}

{com}. collapse (mean) share_pres* [fw=pob_cgr], by(estado year)
{res}{txt}
{com}. reshape wide share_presAD share_presOFIC, i(estado) j(year)
{txt}(j = 1958 1963 1968 1973 1978 1983 1988 1993 1998 2000 2006 2012)

Data{col 36}Long{col 43}->{col 48}Wide
{hline 77}
Number of observations     {res}         276   {txt}->   {res}23          
{txt}Number of variables        {res}           4   {txt}->   {res}25          
{txt}j variable (12 values)             {res}year   {txt}->   (dropped)
xij variables:
                           {res}share_presAD   {txt}->   {res}share_presAD1958 share_presAD1963 ... share_presAD2012
                         share_presOFIC   {txt}->   {res}share_presOFIC1958 share_presOFIC1963 ... share_presOFIC2012
{txt}{hline 77}

{com}. missings dropvars

{p 0 4}{txt}Checking missings in {res} estado share_presOFIC1958 share_presAD1958 share_presOFIC1963 share_presAD1963 share_presOFIC1968 share_presAD1968 share_presOFIC1973 share_presAD1973 share_presOFIC1978 share_presAD1978 share_presOFIC1983 share_presAD1983 share_presOFIC1988 share_presAD1988 share_presOFIC1993 share_presAD1993 share_presOFIC1998 share_presAD1998 share_presOFIC2000 share_presAD2000 share_presOFIC2006 share_presAD2006 share_presOFIC2012 share_presAD2012:{txt}{p_end}
23 observations with missing values

{p}note: share_presOFIC1958 share_presOFIC1963 share_presOFIC1968 share_presOFIC1973 share_presOFIC1978 share_presOFIC1983 share_presOFIC1988 share_presOFIC1993 share_presAD1998 share_presAD2000 share_presAD2006 share_presAD2012 dropped{p_end}

{com}. 
. 
. * save correlation with AD 1958
. mat results = J(11, 2, 0)
{txt}
{com}. local i = 1
{txt}
{com}. foreach year of numlist 1963(5)1998 2000(6)2012 {c -(}
{txt}  2{com}.         cap cor share_presAD1958 share_presAD`year'
{txt}  3{com}.         if _rc == 0 {c -(}
{txt}  4{com}.         mat results[`i',1] = `year'
{txt}  5{com}.         mat results[`i',2] = `r(rho)'
{txt}  6{com}.         {c )-}
{txt}  7{com}.         else {c -(}
{txt}  8{com}.         cor share_presAD1958 share_presOFIC`year'
{txt}  9{com}.         mat results[`i',1] = `year'
{txt} 10{com}.         mat results[`i',2] = `r(rho)'
{txt} 11{com}.         {c )-}
{txt} 12{com}.         local i = `i' + 1
{txt} 13{com}. {c )-}
{txt}(obs=23)

             {c |} sha~1958 sha~1998
{hline 13}{c +}{hline 18}
share_p~1958 {c |}{res}   1.0000
{txt}share_p~1998 {c |}{res}  -0.1796   1.0000

{txt}(obs=23)

             {c |} sha~1958 sha~2000
{hline 13}{c +}{hline 18}
share_p~1958 {c |}{res}   1.0000
{txt}share_p~2000 {c |}{res}  -0.0643   1.0000

{txt}(obs=23)

             {c |} sha~1958 sha~2006
{hline 13}{c +}{hline 18}
share_p~1958 {c |}{res}   1.0000
{txt}share_p~2006 {c |}{res}   0.3405   1.0000

{txt}(obs=23)

             {c |} sha~1958 sha~2012
{hline 13}{c +}{hline 18}
share_p~1958 {c |}{res}   1.0000
{txt}share_p~2012 {c |}{res}   0.4956   1.0000

{txt}
{com}. 
. * use results
. clear 
{txt}
{com}. svmat results
{txt}number of observations will be reset to 11
Press any key to continue, or Break to abort
{p}
Number of observations ({bf:_N}) was 0,
now 11.
{p_end}

{com}. rename results1 year
{res}{txt}
{com}. rename results2 cor1958
{res}{txt}
{com}. 
. * Figure E4A
. #delimit;
{txt}delimiter now ;
{com}. twoway (connected cor1958 year if year > 1958, 
>             lcolor(white) mcolor(white) 
>             mlwidth(thick) mlcolor(white) msize(large))
>                 
>            (connected cor1958 year if year >= 1963 & year <= 2012, 
>             lcolor(black) mcolor(black) lwidth(medthick)
>             mlwidth(thick) mlcolor(white) msize(large))
>                 
>            (scatter cor1958 year if year == 1963, 
>             mcolor(black) 
>             mlwidth(thick) mlcolor(white) msize(large))
>                 
>            (scatter cor1958 year if year >= 1998 & year <= 2012, 
>             lcolor(black) mcolor(black) lwidth(medthick) msymbol(diamond)
>             mlwidth(thick) mlcolor(white) msize(large))
>                 
>            (scatter cor1958 year if year == 1998, 
>             lcolor(black) mcolor(blue) msymbol(diamond)
>             mlwidth(thick) mlcolor(white) msize(large)),
> 
>                 yline(0, lwidth(thick) lcolor(gs12))
>                 graphregion(fcolor(white) lcolor(white) margin(zero))
>         plotregion(fcolor(white) lstyle(none) lcolor(white) ilstyle(none))
>                 xsize(7) ysize(5)       
>                 title("", size(large))
>                 ytitle("Correlation with 1958 AD vote share", color(black) size(large))
>                 xtitle("")
>                 yscale()
>                 ylabel(-.2(.2)1, labsize(large) glcolor(white) angle(horizontal))
>                 xlabel(1958 "1958"
>                 1968 "1968"
>                 1978 "1978"
>                 1988 "1988"
>                 1998 "98  "
>                 2000 "  00"
>                 2006 "2006"
>                 2012 "2012", labsize(large))
>                 xscale( range(1958 2014))
>         legend(order(3 "AD vs. AD 1958" 4 "Chávez vs. AD 1958") pos(8) ring(0) rows(2)                   region(lcolor(white)));
{res}{txt}
{com}. graph export "figures/FigureE4b.pdf", replace;
{txt}{p 0 4 2}
file {bf}
/Users/kronick/Riker/Replication/figures/FigureE4b.pdf{rm}
saved as
PDF
format
{p_end}

{com}. #delimit cr
{txt}delimiter now cr
{com}.         
. 
. 
. 
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.                         **      **      **      **      **      **      **      **      **      **      **      **      **
.         
. *-------------------------------------------------------------------------------
. * E4c–g
. *-------------------------------------------------------------------------------
. 
. 
. * data
. use "data/inputs/MunicipioData_AD_Chavez.dta", clear
{txt}
{com}.  
.  
. * AD correlations
. local year = 1963
{txt}
{com}. foreach letter in c d e f g h i {c -(}
{txt}  2{com}. 
. 
. * graph
. #delimit;
{txt}delimiter now ;
{com}. twoway (scatter share_presAD`year' share_presAD1958, 
>         msize(small) mcolor(gs10))
>      
>            (lfit  share_presAD`year' share_presAD1958, 
>             lcolor(black) lpattern(dash)),
>                 
>                 graphregion(fcolor(white) lcolor(white) margin(zero))
>         plotregion(fcolor(white) lstyle(none) lcolor(white) ilstyle(none))
>         xsize(8) ysize(5)
>                 title("", size(large))
>                 ytitle("`year' AD Vote Share", color(black) size(large))
>                 xtitle("1958 AD Vote Share", size(large))
>         yscale()
>                 ylabel(0(.2).8, labsize(large) glcolor(white) angle(horizontal))
>                 xlabel(0(.2)1, labsize(large))
>                 xscale()
>         legend(off);
{txt}  3{com}.                 graph export "figures/FigureE4`letter'.pdf", replace;
{txt}  4{com}. #delimit cr
{txt}delimiter now cr
{com}. 
. local year = `year' + 5
{txt}  5{com}. {c )-}
{res}{txt}{p 0 4 2}
file {bf}
/Users/kronick/Riker/Replication/figures/FigureE4c.pdf{rm}
saved as
PDF
format
{p_end}
{res}{txt}{p 0 4 2}
file {bf}
/Users/kronick/Riker/Replication/figures/FigureE4d.pdf{rm}
saved as
PDF
format
{p_end}
{res}{txt}{p 0 4 2}
file {bf}
/Users/kronick/Riker/Replication/figures/FigureE4e.pdf{rm}
saved as
PDF
format
{p_end}
{res}{txt}{p 0 4 2}
file {bf}
/Users/kronick/Riker/Replication/figures/FigureE4f.pdf{rm}
saved as
PDF
format
{p_end}
{res}{txt}{p 0 4 2}
file {bf}
/Users/kronick/Riker/Replication/figures/FigureE4g.pdf{rm}
saved as
PDF
format
{p_end}
{res}{txt}{p 0 4 2}
file {bf}
/Users/kronick/Riker/Replication/figures/FigureE4h.pdf{rm}
saved as
PDF
format
{p_end}
{res}{txt}{p 0 4 2}
file {bf}
/Users/kronick/Riker/Replication/figures/FigureE4i.pdf{rm}
saved as
PDF
format
{p_end}

{com}. 
. 
. * Chávez correlations
. local year = 1998
{txt}
{com}. foreach letter in j k l m {c -(}
{txt}  2{com}.         
. * graph
. #delimit;
{txt}delimiter now ;
{com}. twoway (scatter share_presOFIC`year' share_presAD1958, 
>         msize(small) mcolor(gs10))
>      
>            (lfit  share_presOFIC`year' share_presAD1958, 
>             lcolor(black) lpattern(dash)),
>                 
>                 graphregion(fcolor(white) lcolor(white) margin(zero))
>         plotregion(fcolor(white) lstyle(none) lcolor(white) ilstyle(none))
>         xsize(8) ysize(5)
>                 title("", size(large))
>                 ytitle("`year' Chávez Vote Share", color(black) size(large))
>                 xtitle("1958 AD Vote Share", size(large))
>         yscale()
>                 ylabel(0(.2).8, labsize(large) glcolor(white) angle(horizontal))
>                 xlabel(0(.2)1, labsize(large))
>                 xscale()
>         legend(off);
{txt}  3{com}.                 graph export "figures/FigureE4`letter'.pdf", replace;
{txt}  4{com}. #delimit cr
{txt}delimiter now cr
{com}. 
. if `year' == 1998 {c -(}
{txt}  5{com}.         local year = `year' + 2
{txt}  6{com}.         {c )-}
{txt}  7{com}. else {c -(}
{txt}  8{com}.         local year = `year' + 6
{txt}  9{com}.         {c )-}
{txt} 10{com}. 
.         
. {c )-}
{res}{txt}{p 0 4 2}
file {bf}
/Users/kronick/Riker/Replication/figures/FigureE4j.pdf{rm}
saved as
PDF
format
{p_end}
{res}{txt}{p 0 4 2}
file {bf}
/Users/kronick/Riker/Replication/figures/FigureE4k.pdf{rm}
saved as
PDF
format
{p_end}
{res}{txt}{p 0 4 2}
file {bf}
/Users/kronick/Riker/Replication/figures/FigureE4l.pdf{rm}
saved as
PDF
format
{p_end}
{res}{txt}{p 0 4 2}
file {bf}
/Users/kronick/Riker/Replication/figures/FigureE4m.pdf{rm}
saved as
PDF
format
{p_end}

{com}. 
. 
. * End
. 
{txt}end of do-file

{com}.         
. *------------------------------------------------------------------------------*
. log close
      {txt}name:  {res}<unnamed>
       {txt}log:  {res}/Users/kronick/Riker/Replication/log/logStata.smcl
  {txt}log type:  {res}smcl
 {txt}closed on:  {res}30 Nov 2022, 10:30:18
{txt}{.-}
{smcl}
{txt}{sf}{ul off}